Top x records [message #371634] |
Fri, 17 November 2000 04:27 |
Walter Lee
Messages: 1 Registered: November 2000
|
Junior Member |
|
|
Hi,
Is there a quick way in oracle sql to retrieve for example the top 5 records from a query.
For example in MS SQL Server one can run "select top 5 * from tablename"
Thanks,
WL
|
|
|
|
Re: Top x records [message #371640 is a reply to message #371634] |
Sat, 18 November 2000 00:31 |
Raj_adhikari
Messages: 1 Registered: November 2000
|
Junior Member |
|
|
try this :
suppose your query is based on salary then the query would be like this-
select distinct sal from tmp a
where 5>(select count(*) from tmp b
where a.sal<b.sal) order by sal desc
regards....
Rajendra
|
|
|