[英]ora-00937 Not a single-group group function - issues with count
select au_lname, au_fname, count(titles.title)
from titleauthor
join titles ON titles.title_id=titleauthor.title_id
join authors ON authors.au_id=titleauthor.au_id
having COUNT(titles.title) > 2;
I keep receiving the ora-00937 error, but I'm not entirely clear why it's not a single-group group function. 我一直收到ora-00937错误,但我不十分清楚为什么它不是单组分组函数。 Anyone have any idea?
有人知道吗
You simply need a group by
: 您只需要按以下方式
group by
:
select a.au_lname, a.au_fname, count(*)
from titleauthor ta join
authors a
ON a.au_id = ta.au_id
having COUNT(*) > 2;
In addition, you don't need to join to titles
-- unless some of the titles are actually NULL
or duplicated (which seems unlikely). 此外,您不需要加入
titles
-除非某些标题实际上是NULL
或重复的(这似乎不太可能)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.