You need to sign in to do that
Don't have an account?
Craig Jones
Getting data from multiple objects through Junction
I have 2 object that are related to each other, via a Junction object, and i want to get data from them both in one query.
My set up is:
Product__c: name, description
JuncProdToAccount: Product__c, Account (these two links are master-detail relationships)
Account (standard salesforce account object)
I am wanting to write some SOQL that will get all Products... and if there is a link to the Junction table, return the Account.Name of the linked Account.
Is this possible in one query?
Select Id, (Select Account__r.Name from JuncObjects__r) from Product
All Answers
is this what you are talking about?
account.
My thinking was to go the query against the product table, that way i can
get all the products, then see which ones link to an account through the
junction table and get the account names from the ones that do.
Hope that makes sense
Select Id, (Select Account__r.Name from JuncObjects__r) from Product
One last thing you may be able to help me with :)... how will i think be
able to access that field within a visualforce page? What would be its
variable name?