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
jeremy_wjeremy_w 

doubt over the validity of this SOQL query

Hi

 

I've created the following query to tell me "how many contacts have been assigned to a case in the date period passed in for the account passed in". However I'm not convinced it's correct:

 

 

Integer SFuserscases=[SELECT count() FROM Contact WHERE (AccountId=:acctID) AND (Id in (SELECT ContactId FROM Case WHERE AccountId=:acctID and (CreatedDate>=:RdsDT and CreatedDate<:RdeDT)))];

 

 

Can someone comment and perhaps improve it if it's not quite right?

 

Thanks

Jeremy

 

Message Edited by jeremy_w on 07-06-2009 08:14 AM
Message Edited by jeremy_w on 07-06-2009 08:14 AM
Richie DRichie D

Hi Jeremy_w,

 

Can I suggest that you create some test methods to test your statement. If you're basing the fact of whether your code is correct by the sayso of someone on a discussion board is pretty dangerous - I could say its perfect and I've no idea or actually tried it out.

 

Have you tried it is something like eclipse to see if you get the correct results if you don't want to write more code?

 

Rich.