You need to sign in to do that
Don't have an account?
Savi3
To query Opportunity field
Hi,
Can someone help me to query some fields of Opportunity along with contact fields.
Opportunity has a field Account and there are contacts for this account. I want to retrieve some fields of opportunity and fields of contacts with the accountId .
Please help..
Select Id, Name, (Select Id, Name From Opportunities), (Select Id, Name From Contacts) From Account
You have to query the accountID field from Opportunity and then use this to query the related account separately.
Id accId = [SELECT accountID FROM Opportunity where Id=:oppID].accountID;
List<contacts> contactList = [SELECT id,(SELECT id,name from contacts) from Account where id=:accID];
V1nit,
your query would give contact records for all accounts, is there a way we can query opportunities and from those opportunities take the accounts and in turn get contacts.
I am not sure if this is even feasible.
Anybody has ideas?