I'm trying to get a table of all the individual tasks that belong to specific leads. I only want to pull tasks that belong to leads with a custom checkbox field "hedgehog_account__c = true." The hedgehog_account__c field is on the lead record.
Here's the SOQL query attempting to do this.
SELECT Completed_Date__c, CreatedDate, Subject, Subject__c, CreatedBy.Name, Owner.Name FROM Task WHERE Completed_Date__c = LAST_N_DAYS:90 AND Lead.Hedgehog_Account__c = true
I also tried nesting
...(SELECT Lead.hedgehog_account__c FROM Lead WHERE hedgehog_account__c = true)... in the main SELECT statement of my SOQL query, but that also didn't work.
I got an error in either case saying :
Lead relationship not understood, please use __r to specify any custom relationship fields.
I'm very new to SOQL (limited experience with SQL as well), so apologies for any glaring errors. Any suggestions on the best place to learn APEX and SOQL would be greatly appreciated as well!