SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
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 ChatGPT!

Copy Clear