问题
I have table with Values and Date. Values in Integer
and date is Integer
in milliseconds
from 1970's...
I need to get sum(value) for each month and i haven't any idea how to do it with date in milliseconds. Is it possible?
Thanks.
My table "entry"
amount | date
----------------------------
300 | 1390075200000
150 | 1390132500000
20 | 1391075200000
... | .............
What i want to get:
01.2014 | 450
02.2014 | 20
....
回答1:
You have to convert the dates into a format supported by SQLite so that you can extract the month:
SELECT strftime('%Y-%m', date / 1000, 'unixepoch') AS month,
SUM(value) AS sum
FROM entry
GROUP BY 1
来源:https://stackoverflow.com/questions/23220501/sum-over-values-by-month-in-milliseconds