1

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;
Insane Skull
  • 9,220
  • 9
  • 44
  • 63

1 Answers1

0

Try this:

update invoice_collection IC
 inner join Employee E on IC.CollectedBy=E.id
 inner join invoice INV on INV.InvoiceNo=IC.InvoiceNo
 set journalFetchStatus=0
 where IC.OperatorCode=#operatorCode#
and E.Id=#staffId#
and TxnDate > #CreatedOn#;
Abhishek Ginani
  • 4,511
  • 4
  • 23
  • 35