Hi Mathan, You don't have to mention specifically the keywords 'INNER JOIN' in SOQL as compared to SQL in other database languages. Please look at below two ways of Inner Joins.
Right Inner Join - Look Up Parent field Values - No Orphans. List<AccountFeed> listAccFeed = [select Parent.ID,Parent.Name, Id from AccountFeed where ParentId <> null and Parent.Type = 'Prospect'];
Left Inner Join - LookUp Children Values no childless parent Query - List<Account> listAcc = [select Id, (select Parent.ID,Parent.Name, Id from Account.Feeds) from Account where Id in (select ParentId from AccountFeed where ParentId <> null )];
You can use the below article for more understanding. I used the same. Hope this helps now. https://developer.salesforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com
If i understand your query correctly, you are trying to retrieve AccountFeed for a list of accounts. If so, here is the query you can use...
List<Account> listAcc = [select Account.id, (select AccountFeed.id from Account.Feeds) from Account where id in :ids]; //ids is just a variable i used for holding the list of Account ID. The single relationship query will give AccountFeed records for Accounts given in the parameters.
Hi Mathan, You don't have to mention specifically the keywords 'INNER JOIN' in SOQL as compared to SQL in other database languages. Please look at below two ways of Inner Joins.
Right Inner Join - Look Up Parent field Values - No Orphans. List<AccountFeed> listAccFeed = [select Parent.ID,Parent.Name, Id from AccountFeed where ParentId <> null and Parent.Type = 'Prospect'];
Left Inner Join - LookUp Children Values no childless parent Query - List<Account> listAcc = [select Id, (select Parent.ID,Parent.Name, Id from Account.Feeds) from Account where Id in (select ParentId from AccountFeed where ParentId <> null )];
You can use the below article for more understanding. I used the same. Hope this helps now. https://developer.salesforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com
Hi Mathan,
You don't have to mention specifically the keywords 'INNER JOIN' in SOQL as compared to SQL in other database languages.
Please look at below two ways of Inner Joins.
Right Inner Join - Look Up Parent field Values - No Orphans.
List<AccountFeed> listAccFeed = [select Parent.ID,Parent.Name, Id from AccountFeed where ParentId <> null and Parent.Type = 'Prospect'];
Left Inner Join - LookUp Children Values no childless parent
Query - List<Account> listAcc = [select Id, (select Parent.ID,Parent.Name, Id from Account.Feeds) from Account
where Id in (select ParentId from AccountFeed where ParentId <> null )];
You can use the below article for more understanding. I used the same. Hope this helps now.
https://developer.salesforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com
Thanks,
Chellappa
All Answers
Its invalid. Please let me know, what you would like to retrieve and from where
If i understand your query correctly, you are trying to retrieve AccountFeed for a list of accounts. If so, here is the query you can use...
List<Account> listAcc = [select Account.id, (select AccountFeed.id from Account.Feeds) from Account where id in :ids];
//ids is just a variable i used for holding the list of Account ID.
The single relationship query will give AccountFeed records for Accounts given in the parameters.
I hope this is what you are looking for.
Thanks,
Chellappa
Hi Mathan,
You don't have to mention specifically the keywords 'INNER JOIN' in SOQL as compared to SQL in other database languages.
Please look at below two ways of Inner Joins.
Right Inner Join - Look Up Parent field Values - No Orphans.
List<AccountFeed> listAccFeed = [select Parent.ID,Parent.Name, Id from AccountFeed where ParentId <> null and Parent.Type = 'Prospect'];
Left Inner Join - LookUp Children Values no childless parent
Query - List<Account> listAcc = [select Id, (select Parent.ID,Parent.Name, Id from Account.Feeds) from Account
where Id in (select ParentId from AccountFeed where ParentId <> null )];
You can use the below article for more understanding. I used the same. Hope this helps now.
https://developer.salesforce.com/page/A_Deeper_look_at_SOQL_and_Relationship_Queries_on_Force.com
Thanks,
Chellappa