Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Select the row with the highest value
One solution is:
SELECT field
FROM table
WHERE datefield = (
SELECT MAX(datefield)
FROM table);
There are others.
Daniel Morgan
Kalamaro wrote:
> Hi. I want to select the row (just one) with the highest value of a given
> column. I mean, if i have the columns "data" and "date", i need to get the
> value of "data" where "date" is the most recent (the highest value of this
> field).
>
> I've tried several ways but they don't work:
>
> "select max(date) from table" -> this selects the newest date, but i want to
> get the value of "data", and if i put
> "select data,max(date) from table" it doesn't work
> "select data from table where rownum=1 order by date desc" -> returns a bad
> value, not the last
>
> thanks
Received on Sun Jan 20 2002 - 03:54:01 CST
![]() |
![]() |