akufen Posted September 18, 2006 Share Posted September 18, 2006 HiI have a association table - rel_movie_rating - which has the columns movie_id and rating_id. How can I form a query which returns the most frequent movie_id's in the table? Thanks! Quote Link to comment Share on other sites More sharing options...
shoz Posted September 18, 2006 Share Posted September 18, 2006 [code]SELECT movie_id, COUNT(*) AS num FROM table GROUP BY movie_id ORDER BY num[/code] Quote Link to comment Share on other sites More sharing options...
akufen Posted September 18, 2006 Author Share Posted September 18, 2006 Many thanks, this made my day. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.