Reputation: 516
This is my table structure
I need to subtract Deposit And Withdrawal based on GROUP BY Bank
Expected Output
Bank balance
1 1000.00
2 300.00
3 500.00
Upvotes: 2
Views: 57
Reputation: 133380
You could use case when
select bank, sum( case when bankType ='Withdrawal'
then -BankRs
else BankRs end ) balance
from your_table
group by bank
Upvotes: 2