Re: AVG function in order by clause

2004-05-05 Thread Paul DuBois
At 19:41 +0200 5/5/04, Julien Martin wrote: Hello, 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_EST

Re: AVG function in order by clause

2004-05-05 Thread Carsten R. Dreesbach
Pretty simple, declare an alias in your query and use it in the ORDER BY, i.e.:   SELECT  DB_ESTABLISHMENT_NAME, AVG(DB_GRADE) AS AVGGRADEFROM  ESTABLISHMENTS ES LEFT OUTER JOIN GRADES GR ONES.DB_ESTABLISHMENT_ID=GR.DB_ESTABLISHMENT_IDGROUP BY  ES.DB_ESTABLISHMENT_IDHAVING  AVG(DB_GRADE) > 2ORDER B

Re: AVG function in order by clause

2004-05-05 Thread Daniel Clark
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

Re: AVG function in order by clause

2004-05-05 Thread Josh Trutwin
On Wed, 5 May 2004 19:41:32 +0200 Julien Martin <[EMAIL PROTECTED]> wrote: > Hello, > > Thanks a lot for the replies. I have changed the query as follows: > > ** > SELECT > DB_ESTABLISHMENT_NAME, > AVG(DB_GRADE) > > FROM > ESTABLISHMENTS ES L

AVG function in order by clause

2004-05-05 Thread Julien Martin
Thank you all for your replies. Everything works now!! Julien. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: AVG function in order by clause

2004-05-05 Thread Victor Pendleton
What kind of problem are you having? You can use the ordinal postion. ORDER BY 2 [ASC|DESC]. 2 represents the second column. -Original Message- From: Julien Martin To: '[EMAIL PROTECTED]' Sent: 5/5/04 12:41 PM Subject: AVG function in order by clause Hello, Thanks a lot for t

AVG function in order by clause

2004-05-05 Thread Julien Martin
Hello, 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.D