#1111 - 组功能使用无效
我正在使用以下查询来尝试获取从每个项目检索最大数量的幻灯片总数(总和),但是我收到以下错误(#1111 - 组功能的无效使用)。这是查询:
SELECT COALESCE(project,'Total') as Project, SUM(MAX(slides)) as Slides
FROM projects_tbl
WHERE date BETWEEN '2010-01-01' AND '2010-12-31'
GROUP BY Project with ROLLUP
如果我删除 SUM(),那么它会起作用,但是,我无法获得所有项目/幻灯片的准确总数。
预先感谢您的所有回复。
I am using the following query in an attempt to get total number(sum) of slides retrieving the max number from each project, however I am receiving the following error (#1111 - Invalid use of group function). Here's the query:
SELECT COALESCE(project,'Total') as Project, SUM(MAX(slides)) as Slides
FROM projects_tbl
WHERE date BETWEEN '2010-01-01' AND '2010-12-31'
GROUP BY Project with ROLLUP
If I remove the SUM(), then the it works, however, I do not get an accurate total for all of the projects/slides.
Thanks in advance for any and all replies.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试类似的操作:
您需要获得每个项目的最大值,然后您可以对所有项目求和。
You can try with something like:
You need to obtain the max for each project, and after this you can sum all.