I am new in apex. I want to write a trigger in apex for before insert. I have to standard object (Contact, Opportunity).
SELECT sum(amount), Bussiness__c from opportunity where stagename='Closed Won' and id='006i000000Kt683AAB' group by Bussiness__c
I want when trigger runs this get sum(Amount) field and Bussiness__c value and then update Contact Total_Business__c with Sum(Amount) Value. Here Bussiness__C is contact id at opportunity object.
Thanks in advance and Waiting for your positive Response.