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.