You need to sign in to do that
Don't have an account?
Querying SOQL with Lookup fields
How would I add in a lookup field to a SOQL query?
More specifically, I'm running a query that returns results based on a lookup field itself. Actually it's a lookup field to a lookup field, as odd as it may seem, so I can't just type Contact__r.Name for instance, and as far as I know I can't reference anything two levels deep, so Contact__r.Account__r.Name is out, or am I wrong about this?
Or does anyone have any workarounds so I can get the Name field from the Account object from a child of the Contact object and include it into the filtering results of a SOQL call?
Example: [select Id from Child_Of_Contact where Contact__r.Account__r.Name =:'Ted'];
Hi,
I think the query mentioned by you should work.
Which version of Eclipse IDE are you using?
I ran the below query in my IDE and it is giving the required results.
Select Contact.Account.Name from Contact where Contact.Account.Name != null
Hope this helps!!!
All Answers
Hi,
I think the query mentioned by you should work.
Which version of Eclipse IDE are you using?
I ran the below query in my IDE and it is giving the required results.
Select Contact.Account.Name from Contact where Contact.Account.Name != null
Hope this helps!!!
Yeah, I made a stupid mistake about the whole thing, and corrected it almost immediately after posting.
Thanks for your reply though!