我无法像这样通过SELECT查询从数据库检索某些数据:
SELECT table.something
FROM table
WHERE table.date BETWEEN 'from' AND 'to'
GROUP BY (each 6 months between the from and to date).
任何想法都可以做到的,而不必通过代码重复视图和外部分组.
解决方法:
这样的事情会起作用:
SELECT
table.something,
CEIL(MONTH(date)/6) as monthVALUE
FROM
table
WHERE
table.date BETWEEN 'from' AND 'to'
GROUP BY
monthVALUE