[ACCEPTED]-SOQL query with subquery-soql
Accepted answer
You could use a semi-join on contacts to 3 filter the contacts to the set you want, something 2 like this
[select id, firstname, lastname,
(select id, status, comment__c, campaignid from CampaignMembers)
from contact where id in
(select contactId from campaignMember where campaignId in :cams];
Another option would be to drive 1 from campaignMmeber instead.
[select contact.id, contact.firstname, contact.lastname,
status, comment__c, campaignId from campaignMembers
where contactId !='' and campaignId in :cams];
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.