You need to sign in to do that
Don't have an account?
rajjjj
parent child relationship queries
HI All,
I have a doubt here.In the following query
SELECT Name, ( SELECT CreatedBy.Name FROM Notes ) FROM Account
Account is the parent object and notes is the child object.
In the nested query it is using CreatedBy.Name.....so that means Notes is parent and User is child.....Is that correct???
If that is true....i dont see any field called CreatedBy in notes....i am able to see only CreatedById.
Please clarify me on this.
Hi Raj,
Each object in Force.com has got Lookup to User object. Hence once you create a record under a object it will store recordID of user who created it in the CreatedBy field. For every object on Force.com you can see CreatedBy field. Since CreatedBy field points to User record you need to explicitly use fields like "Name","Alias",etc to get their field values.
I hope you find this response useful.
Cheers !
So the User is Parent here and Notes is Child......But it looks opposite for me????
No...
The createdby uses a hierarchical lookup on the user object (lookup to itself). One of those special cases. (IIRC)
Hi Raj,
No the Notes object is not the parent object. Every object has got lookup to User object the information like who created the record in that object and his further details are then retrieved using it.
I hope you find this response useful.
Cheers !