我有一个包含列日期和列ID的表(为了简单起见)。我正在进行查询以按周计算总数和分组
SELECT MONTH(table1.Date_1st), YEAR(table1.Date_1st), COUNT(table1.Id)
FROM table1 as table1
WHERE Date_1st BETWEEN '2013-04-01' AND '2013-07-25'
GROUP BY WEEK(Date_1st)
问题是特定周没有结果,结果没有考虑在内。我已经尝试ifnull(table1.Id,0)