I need help with SQL. I have an sqlite table like so;
I need a query which would sum up amount for each type AND year-month (as you can see the year is also extracted since the data can span several years). I've come to something half-way, but I'm a bit rusty on SQL.
I've tried a number of combinations of SUM and GROUP BY on my query above but none of them does what I want. What I want is a result something like:
Yes, type should be a foreign key, I simplified things to make it easier to ask the question :) | |||||||||
|
NoteSome DBs don't support group by index so you would have to do this.
| |||||||||||||
|
联系客服