You need to sign in to do that
Don't have an account?

SOQL difference
Hi Guys,
I have a question could you tell me the difference in using theset wo queries?
Query1
list<account>account list=[select id,name from account where id=:(set<Id>AccountId's)];
Query2:
list<account>account list=[select id,name from account where id IN:(set<Id>AccountId's)];
Is there an advantage of using one over the other as a best practice?If so which is better to use because frankly the only difference I can see is the second one checks for contains apart from that I do not see any difference
The difference is that equals operator cannot be used while performing Join in the SOQL, whereas IN operator can be used.
Exampler:
list<Account> acc = [select Id from Account where Id = (Select AccountId from Contact)]; --- NOT ALLOWED
list<Account> acc = [select Id from Account where Id IN (Select AccountId from Contact)]; -- ALLOWED
I hope this solves your queries.
Thanks
Nitin