I'm trying to frame a single SOQL on opportunity with fields from Multiple objects like Account Name, Contact Name ,Contact Ph , Contact Email and the Opplineitems. I'm not sure how to get the Account Name and Contact Details from opp which has lookup.
Opportunity Op=[select id,Name,Stagename,Account__r.Name,(select Product_Name__c,Bid_Type__c from OpportunityLineItems) from opportunity where stagename='Closed-Won' and id=:opptyid];
__r
; OOB SFDC fields never use__c
. Hence relationship from Opportunity to Account is simplyaccount.someAccountOOBfieldname
oraccount.someAccountCustomfieldname__c
– cropredy Aug 21 '15 at 19:40