标签: php mysql codeigniter
这是我的表结构
我需要根据GROUP BY Bank减去存款和取款
预期产量
Bank balance 1 1000.00 2 300.00 3 500.00
答案 0 :(得分:2)
您可以在
select bank, sum( case when bankType ='Withdrawal' then -BankRs else BankRs end ) balance from your_table group by bank