Reputation: 28907
I have the following query
select
sub.W
from
(select
W, count(W) as N
from L
group by W) sub
where
sub.N >= max(sub.N)
and I get this error:
Error code 1111, SQL state HY000: Invalid use of group function
Line 1, column 1
What is wrong?
Upvotes: 0
Views: 177
Reputation: 25753
Try:
select sub.W
from
(
select W, count(W) as N
from L
group by W
) sub
where sub.N >= (select max(N)
from (
select W, count(W) as N
from L
group by W
) sub2)
Upvotes: 0
Reputation: 247690
Have you tried this:
select sub.W
from
(
select W, count(W) as N
from L
group by W
) sub
where n >= (select max(N)
from
(
select count(W) as N
from L
group by W
) x)
Upvotes: 3