Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sql Query
Paul wrote:
> I,m new to sql and wonder if anybody could help me with the following:
> If I had a table with say order id and order total i.e
>
> id total
> 213 567.35
> 345 444.00
> 214 32.99
> and so on how would I find say just the fourth highest total from the
> table without displaying the rest of the table.
> Thanks for any help.
If you have a sufficiently new version of Oracle (I think 8.1.5 or higher) you could do the following:
select id,total from
(select id,total,rownum r from
(select id,total from table_name order by total desc))
I hope this works. At the moment I don't have my Oracle available to test.
Hope that helps,
Lothar
-- Lothar Armbrüster | la_at_oktagramm.de Hauptstr. 26 | la_at_heptagramm.de D-65346 Eltville | lothar.armbruester_at_t-online.deReceived on Fri Nov 24 2000 - 10:42:12 CST