You need to sign in to do that
Don't have an account?
Elan Cramer 8
SOQL statement on a Custom Object
I have a custom object called University/Company. On the custom object is a lookup field to an account object called Company. I'd like to write a SOQL query that pulls the task information from this Company object via the University/Company object. Is this possible? I'm relatively new to SOQL, so any help would be greatly appreciated. Thanks!
For reference, getting the tasks from Opportunity:
All Answers
For reference, getting the tasks from Opportunity:
One other quick question--on the custom object, University/Company, there's a custom field called University. Do you know if there's a way to include that column in the output?
Also, mark a best answer if you think this question is solved. :)
Question is why do you even need University field when you're querying tasks from an Account?
SELECT Id FROM Task WHERE WhatId IN (SELECT Company__c FROM University_Company__c WHERE University_ID__c='001G000000stRptIAE')
Does this query return any records? I don't think so, because you're giving an account Id to check against the University_Id__c. Get the correct University_Id__c which has an accountId. If yes, this below query should workfine. As long as the Company__c is returning the Account Ids, we should be good. That's what the WhatId on task is looking for.