How do I resolve MySQL Error 1111 in the SQL statement

34 Views Asked by At

I'm executing an SQL statement below in Workbench

select count(1) as NoOfMovies, rating from film 
where rating <> 'G' 
group by rating 
having count(NoOfMovies) > 200;

But I'm getting an error here.

ERROR 1111 (HY000): Invalid use of group function

The statement looks good and I'm unable to understand what is causing this error. Clauses are also in order.

Thanks, Piyush.

0

There are 0 best solutions below