Author Topic: Help w/ avg and group in a query  (Read 302 times)

0 Members and 1 Guest are viewing this topic.

Offline refikingTopic starter

  • Enthusiast
  • Posts: 489
    • View Profile
Help w/ avg and group in a query
« on: March 02, 2010, 02:54:12 PM »
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());

Offline mapleleaf

  • Enthusiast
  • Posts: 237
    • View Profile
Re: Help w/ avg and group in a query
« Reply #1 on: March 02, 2010, 04:11:46 PM »
What is your error?