ohdang888 Posted July 16, 2008 Share Posted July 16, 2008 i want to list out the top video submitters: each row has u_id in it, and that is their user id. I want to order it by the number of rows that contain the same u_id... How would i do this??? my thought: $vids = mysql_query("SELECT `u_id` FROM `videos` GROUP BY `u_id` ORDER BY COUNT(DISTINCT u_id) DESC LIMIT 10")or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/114971-order-by-count/ Share on other sites More sharing options...
ohdang888 Posted July 16, 2008 Author Share Posted July 16, 2008 rump de bump. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/114971-order-by-count/#findComment-591707 Share on other sites More sharing options...
MadTechie Posted July 16, 2008 Share Posted July 16, 2008 this is mysql problem in anycase.. try SELECT count(`u_id`) as total, `u_id` FROM `videos` ORDER BY total ASC LIMIT 10; Quote Link to comment https://forums.phpfreaks.com/topic/114971-order-by-count/#findComment-591708 Share on other sites More sharing options...
gudfry Posted July 17, 2008 Share Posted July 17, 2008 Maybe your looking for this; $vid=mysql_query("SELECT `u_id` FROM `videos` GROUP BY `u_id` ORDER BY COUNT(DISTINCT u_id) ASC LIMIT 10"; Quote Link to comment https://forums.phpfreaks.com/topic/114971-order-by-count/#findComment-592124 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.