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()); 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? 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
Archived
This topic is now archived and is closed to further replies.