This is the Query which i did earlier to fetch sum
select E.Id as StaffId,
SUM(IC.AmountReceived) as totalAmount,INV.InvoiceType as AccountType
from invoice_collection IC,employee E ,invoice INV
where IC.CollectedBy=E.id and IC.OperatorCode=#operatorCode#
and INV.InvoiceNo=IC.InvoiceNo and E.Id=#staffId# and IC.journalFetchStatus=1
and TxnDate > #CreatedOn#
group by INV.InvoiceType;
I am trying to solve another update issue with the same conditions
update invoice_collection set journalFetchStatus=0
where IC.CollectedBy=E.id and IC.OperatorCode=#operatorCode#
and INV.InvoiceNo=IC.InvoiceNo and E.Id=#staffId#
and TxnDate > #CreatedOn#
group by INV.InvoiceType;