Re: Newbie Q - maximum value of a column

From: Matt Marrow [LOGICA][dc] <mmarrow_at_diana>
Date: 1996/10/22
Message-ID: <54jdjg$14l_at_zeus.mobile.com>#1/1


Imtiaz Ahmed (imtiaz_at_qatar.net.qa) wrote:
: select key
: from table
: where rownum <=1
: order by key desc ;

As far as I can remember, this is not a solution to the problem below because Oracle will do the rownum clause and then order the resultant rowset (consisting of one row) thus you won't get the highest value, just the value first out of the query.

I suggested using MAX() instead...

Hope this helps

Matt

mmarrow_at_pacbell.mobile.com

: Kevin Loney <"75663,327"_at_compuserve.com> wrote in article
: <3267D73C.2ED_at_compuserve.com>...
: > Ku Kam Ming wrote:
: > >
: > > A column named 'key NUMBER(6)' is used as primary key. I would like to
: > > know the simplest way to get the maximum value of the column 'key'.
: > >
: > >
: >
: > select MAX(key_col)
: > from table;
: >
  Received on Tue Oct 22 1996 - 00:00:00 CEST

Original text of this message