You need to sign in to do that
Don't have an account?
Too Many SOQL Queries - Don't know how to solve.
Gentlemen,
I am facing the problem with the following query:
Select Id,
Lookupfield_Table01__c,
Lookupfiled_Table02__c
FROM CustomObject01__c
WHERE
Lookupfield_Table01__c IN (Select Id FROM CustomObject02__c Where CustomFiled01__c = true) AND
Lookupfiled_Table02__c IN (Select Id FROM Account Where CustomFiled02__c = false)
On error occurs, telling my there are too many SOQL steatmans.
Does anybody know some other way to write this query?
Thank you in advance,
André Salgado
Hi,
You might be using the soql query within loop. If yes then try to execute outside loop and see what happens, if no then try to use Batch Apex by setting the no of records executed less than 100 so that the error "Too Many SOQL: Queries" will not come.
If this post solves your problem kindly mark it as solution. if this post is helpful please throw Kudos.
Thanks
All Answers
Hi,
You might be using the soql query within loop. If yes then try to execute outside loop and see what happens, if no then try to use Batch Apex by setting the no of records executed less than 100 so that the error "Too Many SOQL: Queries" will not come.
If this post solves your problem kindly mark it as solution. if this post is helpful please throw Kudos.
Thanks
You are most welcome :). Yes the query is correct. Just we need to avoid writing those within loops to overcome this errors.