Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
select * from transfer_2708; select accnum , tdate as dt_from , lead(tdate) over(partition by accnum order by tdate)-1 as dt_to , sum(amount) over(partition by accnum order by tdate) as balance from ( -- credit select froom as accnum , tdate , -amount as amount from transfer_2708 union all -- debit select too , tdate , amount from transfer_2708 ) order by 1,2

Stuck with a problem? Got Error? Ask AI support!

Copy Clear