Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 sql lite 查询,可以让我获得每天/每周/每月/每年的金额总和。
但我希望能够扩展它,以便我可以自定义分组,即按 3 个月或半年分组等。
这是我的查询
SELECT sum(amt), strftime('%Y-%m',datetime(date_time)) as date FROM sales GROUP BY date ORDER BY date desc
上面的代码让我得到了每个月的总金额。
但是如何使用查询按季度或半年的月份数进行分组?