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! Link to comment https://forums.phpfreaks.com/topic/21144-sorting-by-row-value-occurrence/ 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] Link to comment https://forums.phpfreaks.com/topic/21144-sorting-by-row-value-occurrence/#findComment-93911 Share on other sites More sharing options...
akufen Posted September 18, 2006 Author Share Posted September 18, 2006 Many thanks, this made my day. Link to comment https://forums.phpfreaks.com/topic/21144-sorting-by-row-value-occurrence/#findComment-93917 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.