I have database table that stores data daily
My table current_list
contains:
id
(autoincrement)day
(DATE NOT NULL DEFAULT (date('now')))app_data
(INTGER)mobile_data
(INTEGER)From this table I am able to get data weekly by executing the below query
SELECT id AS id, strftime('%W', day) AS week, app_data, mobile_data
FROM current_list order by week;
which gives me
| id | week | app_data | mobile_data
| 01 | 00 | 100 | 200
| 02 | 00 | 200 | 300
| 03 | 00 | 400 | 670
| 04 | 01 | 700 | 340
| 05 | 01 | 600 | 560
| 06 | 01 | 560 | 230
Now, I need sum of app_data
, mobile_data
weeklywise.
It should be like
| week | Sum(app_data) | Sum(mobile_data)
| 00 | 700 | 1170
| 01 | 1860 | 1300
Can anyone help in this?
SELECT strftime('%W', day) AS week, sum(app_data), sum(mobile_data) FROM current_list order by week GROUP BY week
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With