refiking Posted March 2, 2010 Share Posted March 2, 2010 I am trying to write a query where I get the top 20 cid's in the table based on the top 20 average cid ratings. Here's what I've tried so far: $cid = mysql_query("select distinct cid from c_ratings order by avg(rating) desc limit 20")or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/193930-help-w-avg-and-group-in-a-query/ Share on other sites More sharing options...
mapleleaf Posted March 2, 2010 Share Posted March 2, 2010 What is your error? Quote Link to comment https://forums.phpfreaks.com/topic/193930-help-w-avg-and-group-in-a-query/#findComment-1020600 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.