Finding multiple attributes from the GROUP BY function in a query

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 got the 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 request fails.

Is there a way to get results as desired?

+4
source share
1 answer
 select movie_id, count(*) cnt from review Group by movie_id Having count(*)>1 order by cnt desc 
+8
source

Source: https://habr.com/ru/post/1396801/


All Articles