出于某种奇怪的原因,按周分组返回带有日期时间字段的奇数日期间隔。
“已完成”是一个日期时间字段,并使用此查询:
SELECT
Completed,
COUNT( DISTINCT Table1.ID ) AS ActivityCount
FROM Table1
JOIN Table1Items
ON Table1.ID = Table1Items.ID
JOIN database_database.Table2
ON Table2.Item = Table1Items.Item
WHERE Completed != '0000-00-00' AND Completed >= '2012-09-25' AND Completed <= '2012-10-25'
GROUP BY WEEK(Completed)
我越来越:
Completed ActivityCount CompletedTimestamp
2012-09-25 300 2012-09-25 00:00:00
2012-10-02 764 2012-10-02 00:00:00
2012-10-08 379 2012-10-08 00:00:00
2012-10-17 659 2012-10-17 00:00:00
2012-10-22 382 2012-10-22 00:00:00
有的相隔 7 天,有的相隔 6 天,有的相隔 5 天……还有一个相隔 9 天?
为什么它以如此奇怪的间隔而不是仅仅 7 天对日期进行分组?