Home » RDBMS Server » Server Administration » Query to Retrieve top 3 salaries persons.
Query to Retrieve top 3 salaries persons. [message #51059] Tue, 23 April 2002 05:26 Go to next message
Zahid Rahim
Messages: 31
Registered: April 2002
Member
Hi,
I am needed of a query with which i can retrieve the 3 employees who are earning the higest salaries.it is better to use the default emp table for this query.
Zahid Rahim
Re: Query to Retrieve top 3 salaries persons. [message #51065 is a reply to message #51059] Tue, 23 April 2002 07:26 Go to previous messageGo to next message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
select *
from emp
where rownum < 4
order by salary desc;
Re: Query to Retrieve top 3 salaries persons. [message #51083 is a reply to message #51059] Wed, 24 April 2002 03:42 Go to previous messageGo to next message
ravibabu
Messages: 12
Registered: July 2001
Junior Member
select *
from (select * from emp order by salalary desc)
where rownum < 4
Re: Query to Retrieve top 3 salaries persons. [message #51085 is a reply to message #51065] Wed, 24 April 2002 04:26 Go to previous message
Mike
Messages: 417
Registered: September 1998
Senior Member
This query will not work. It will only order the first 4 rows retrieved by the table.
Previous Topic: How Oracle Handles the date
Next Topic: Tablespace Fragmentation
Goto Forum:
  


Current Time: Wed Dec 25 09:34:48 CST 2024