You need to sign in to do that
Don't have an account?
SOQL Queries / Sub-queries
I have a joint object connecting Contacts and Accounts. We are using person accounts, so the connection to contacts is really to connect to Accounts a second time. We are trying to pull the list of Accounts related to a list of contacts via this joint table.
I believe I need to use the child relationship name for this query. Here is the query for the person accounts
SELECT USER_NAME__C,LASTNAME,FIRSTNAME,ASSOCIATE_NUMBER__PC,ASSOCIATE_STATUS__PC,PERSONMAILINGCITY,PERSONMAILINGSTATE,PERSONEMAIL,CLIENTLIST__C,MEMBERSINCE__C,TOTENGAGEMENTS__C,TOTBILLING__C,COMENGAGEMENTS__C,ACTENGAGEMENTS__C FROM Account WHERE (RecordTypeId='012C0000000Q8EyIAK' OR RecordTypeId='012C0000000Q8ExIAK') AND ASSOCIATE_STATUS__PC!='Terminated' AND Associate_Number__PC!=null AND IsDeleted=FALSE
When I include Clients__pr (The child relationship name for Contact [Master] to Joint Object [Child]) in the SOQL query, I get an invalid field error.
Essentially I am looking for a way to have a query of Accounts referenced on this joint table within a query of contacts.
-Thanks much, Garrett
Clients__pr is the name of the relationship, and doesn't specify any data to return, just the way to link to another object.
So the syntax would be more like this:
Clients__pr.Name