+------+-------+
| type | value |
+------+-------+
| a | 2 |
+------+-------+
| a | 5 |
+------+-------+
| c | 1 |
+------+-------+
| b | 8 |
+------+-------+
| c | 3 |
+------+-------+
| a | 2 |
+------+-------+
| b | 4 |
+------+-------+
| a | 2 |
+------+-------+
Quest: Return the sum of all a
type records as sum_a
and the sum of all b
type records in sum_b
in one query.
It uses more than one query.
After wasting a lot of time with GROUP BY I denied myself the pleasure of solving this alone.
Don't think I'd figured that one out by myself.