I have a trigger on after Insert
and after update
on Contact
.
This trigger updates Account.SalatySumLastContactsLast
, with sum of Contact.Salary
where Contact.mydate__c
is latest.
I simplified the logic for the question, I have to use trigger.
How can I wrote the query to select only contacts with contact.mydate__c
is the latest.
SELECT id,(SELECT id FROM Contacts WHERE myDate ... ) from Account