You need to sign in to do that
Don't have an account?
Software Engine
Need help in writing Query - Urgent
Hi,
Account is the parent table for Opportunity and contacts.
My Driving object should be Opportunity. How to get the contact details of FirstName,Lastname from Oppoortunity Object.
Select o.account.contact.firstname from opportunity o // its giving error.
Thanks,
select id, name, (select id, contactid from opportunitycontactroles where isprimary = true) from opportunity where id = '003......'
select id, name, (select id, name from opportunities), (select id, firstname, lastname from contacts) from account where id = '001.....'
I hope this helps you out. Without more information, I don't know what else to offer for assistance with this query.
~ sfdcfox ~
Hi,
Thaks for yr reply. I should query from five tables. Five Tables and their fields as follows.
Table Name Field
---------------- -----------
Account Name
Contact FirstName
Campaign CampaignCode
Opportunity CloseDate
User RepID
I not getting how to get the Firstname from contacts wtih Opportunity as Driving Object. Because where condition field is also from opportunity table
select o.CloseDate, // from Opportunity
o.Account.Name, // from Account
o. ??? // FirstName from contacts ???
o.Owner.REPID__c, // from User
o.Campaign.Campaign_Code__c // from Campaign
from opportunity o where QA_Done__c = TRUE;
Can any body write a single query to get the result from the above 5 tables with a where a condition?
It is the primary contact associated with Account.