下面是我为VIEW定义规则的方法:
SELECT `yearByWeek`, `week`, ( SELECT MIN(dolphin_day.date) ) AS 'start', ( SELECT SUM(dolphin_day.countHour)) AS 'countHours'
FROM `dolphin_day`
GROUP BY `yearByWeek`, `week`
ORDER BY `yearByWeek` DESC, `week` DESC
VIEW的错误结果如下:
SQL查询的正确结果:
为什么观点的结果是完全错误的?
1条答案
按热度按时间axkjgtzd1#
聚合不应在子查询中。