+------+-------+
| 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.
I guess there might be a more performant solution. However this fulfills all the conditions.
https://gist.github.com/etobi/01bc825e1499ccc49e02