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());