In Oracle you can reference the second field AVG() by the field #. ORDER BY 2
> Thanks a lot for the replies. I have changed the query as follows: > > ************************** > SELECT > DB_ESTABLISHMENT_NAME, > AVG(DB_GRADE) > > FROM > ESTABLISHMENTS ES LEFT OUTER JOIN GRADES GR ON > ES.DB_ESTABLISHMENT_ID=GR.DB_ESTABLISHMENT_ID > > GROUP BY > ES.DB_ESTABLISHMENT_ID > > HAVING > AVG(DB_GRADE) > 2 > > ORDER BY > AVG(GRADE) > ************************** > > Now I am having a problem with the order by clause. How can I have the AVG > function in the ORDER BY clause or how can I sort by average grade? > > Thanks in advance, > > Julien Martin. > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
