· 8 years ago · May 31, 2018, 12:20 PM
1CREATE TABLE IF NOT EXISTS expenses
2 (
3 id INTEGER PRIMARY KEY,
4 name TEXT,
5 amount REAL,
6 category INT NOT NULL,
7 date TEXT
8 )
9
10month total_amount
111 200
122 10
133 1500
144 340
155 124
16
17SELECT SUM(amount) AS total_amount,
18 Strftime("%m", `date`) AS 'month'
19FROM expenses
20WHERE Strftime("%Y", `date`) = '2011'
21GROUP BY Strftime("%m", `date`);