0% found this document useful (0 votes)
26 views1 page

Cumulative Salary-Select Id, Descr, Amt, (Select Sum (Amt) From Ledger Lin Where Lin ) As Balance From Ledger Lout Order by Id

This SQL query selects the ID, description, amount, and running total balance amount from the ledger table by ID, ordering the results by ID. It calculates the balance by taking the sum of all amounts in the ledger table up to and including the current row's ID.

Uploaded by

Amita Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views1 page

Cumulative Salary-Select Id, Descr, Amt, (Select Sum (Amt) From Ledger Lin Where Lin ) As Balance From Ledger Lout Order by Id

This SQL query selects the ID, description, amount, and running total balance amount from the ledger table by ID, ordering the results by ID. It calculates the balance by taking the sum of all amounts in the ledger table up to and including the current row's ID.

Uploaded by

Amita Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

cumulative salary-

select id,descr,amt,(select sum(amt) from ledger lin where lin<=lout.id) as balance from ledger lout order by
id;

You might also like