I have data such as:
| Type | Amount |
|---|---|
| a | 1000 |
| a | 5000 |
| b | 4000 |
| b | 2000 |
| c | 300 |
And would like to sum the amounts where Type is a and b, and minus the amounts where type is c.
I only know how to sum based on one condition, ie: select sum(amount) from xxxx where type = 'a'
Do I need to do a sub-select or is there an easier way?