You need to sign in to do that
Don't have an account?

downward SOQL query
version 47
Given
and
how would I nest the downward SOQLs to achieve
I've tried some variations of WhatId like
Given
SELECT Id, Name, (SELECT Last_Contact_Method__c FROM Contacts ) FROM Account
and
SELECT Id, Status, WhatId FROM Taskwhere Task.WhatId = account.Id from the above query
how would I nest the downward SOQLs to achieve
Select Id, Status, Email_Direction__c, (SELECT Name, (SELECT Last_Contact_Method__c FROM Contacts ) FROM ???? ) FROM Task
I've tried some variations of WhatId like
- What
- Whats
- WhatId
- WhatIds
- What__r
- Whats__r
https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_task.htm
SOQL statements cannot query aggregate relationships more than 1 level away from the root entity object meaning if you were to execute a SOQL query like this, it gives you an error
Contact and task have a parent-child relationship. The same applies to Account so the following queries will work
You should use separate queries to get the result you are looking for. See Using Relationship Queries to learn more
Anudeep