Reputation: 357
I have a table like this
1 Mo1 4
2 Mo7 2
3 Mo3 2
4 Mo2 2
5 Mo9 2
6 Mo8 1
7 Mo6 1
8 Mo4 1
I have got above results using
select movie_id, count(*) cnt from review Group by movie_id order by cnt desc
however if i want to list all movie_id for which cnt>1 my query fails.
Is there any way to get the results as desired ?
Upvotes: 4
Views: 249
Reputation: 38179
select movie_id, count(*) cnt
from review
Group by movie_id
Having count(*)>1
order by cnt desc
Upvotes: 8