我需要在当周的每一天内计算项目。 不幸的是,这个选择不起作用我想...
感谢您的帮助
SELECT strftime('%d', data_item/1000, 'unixepoch') AS valDay,
SUM(numero_item) AS totalDAY
FROM table
WHERE
strftime('%Y', data_item/1000, 'unixepoch') = strftime('%Y', 'now')
AND strftime('%m', data_item/1000, 'unixepoch') = strftime('%m', 'now')
GROUP BY valDay
EDIT I've added the solution (localtime) for future reference:
strftime('%Y', data_item/1000, 'unixepoch''localtime') = strftime('%Y', 'now')
答案 0 :(得分:-1)
你试过吗
SELECT strftime('%d', data_item/1000, 'unixepoch') AS valDay,
SUM(numero_item) AS totalDAY
FROM table
WHERE
strftime('%Y', data_item/1000, 'unixepoch') = strftime('%Y', 'now')
AND strftime('%m', data_item/1000, 'unixepoch') = strftime('%m', 'now')
GROUP BY strftime('%d', data_item/1000, 'unixepoch')
并非所有语言都支持稍后在查询中使用别名(如valDay)