function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DTCFDTCF 

How can this line of code give me a query limit exception?

 

     List<Task> histories = [Select id,Ownerid,whatid,whoid,activitydate,subject,website__c From Task where (whatid=:relatedLink.id and Ownerid=:currentUser and Status='Not Started') limit 1]; 

 

 

 

I'm getting an exception when deploying that is telling me  "Too many query rows: 501".

 

Doesn't the "Limit 1" take care of this??

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
rscottrscott

Governor limits are per transaction. So, you must have already brought back 500 rows from another query or queries.

All Answers

rscottrscott

Governor limits are per transaction. So, you must have already brought back 500 rows from another query or queries.

This was selected as the best answer
DTCFDTCF

Of course, thank you. That did it. Had another query with a limit 500 so this one put it over the edge. Thanks!