You need to sign in to do that
Don't have an account?
sgss
Create a custom object 'A', 'B' and 'C'. Establish 'Master Detail' relationship between them such that 'C' is junction object... SOQL query on 'C'(created above) to retrieve all records of 'C' with name 'John' along with parent details.
Can anyone help me with this?
Create a custom object 'A', 'B' and 'C'. Establish 'Master Detail' relationship between them such that
'C' is junction object.
SOQL query on 'C'(created above) to retrieve all records of 'C' with name 'John' along with parent details.
Create a custom object 'A', 'B' and 'C'. Establish 'Master Detail' relationship between them such that
'C' is junction object.
SOQL query on 'C'(created above) to retrieve all records of 'C' with name 'John' along with parent details.
This just an example of how the parent-child query works...
1. Ways of writing Parent - Child Queries for Standard Objects
Select Id, Name, (Select Id, LastName from Contacts where Lastname='Frank') from Account
2. Child-Parent
Select Id, LastName, Account.Name from Contact
3. Ways of writing Parent - Child Queries for Custom Objects
Select Id, Name, (Select Id, Name from Custom_Object2s__r) from Custom_Object1__c
example 3.Select Id, Name, Custom_Object1__r.Name from Custom_Object2__c
example 2. Select Name, PrarentObject.FieldName FROM C_Object Where Name =: 'John'
Hope this might helps...
Thanks
Akshay
Parent 1 : A
Parent 2 : B
Child : C
on C
parent to child
and child to parent both .
I am not getting whee to use __c and where to use __r
The "__c" stores the salesforce Id(only) and "__r" should be used to get additional fields other than Id in your SOQL. Think of
_r as means to JOIN the relating table/object and _c as the foreign key. So using _c won't require an additional JOIN and hence might be more performance v/s _r.
If you found this answer helpful then please mark it as best answer so it can help others.
Thank You
Akshay