Home » RDBMS Server » Server Administration » Re: How to find the 4th maximum sal?
Re: How to find the 4th maximum sal? [message #371008] Mon, 07 August 2000 15:07 Go to next message
Lee
Messages: 56
Registered: May 1999
Member
This is a backword way but it will do the job:

SELECT MAX(col_1)
FROM temp_1
WHERE ROWNUM < 5
ORDER BY col_1;
Re: How to find the 4th maximum sal? [message #371012 is a reply to message #371008] Tue, 08 August 2000 07:08 Go to previous messageGo to next message
thyilaga
Messages: 1
Registered: August 2000
Junior Member
select salary from table name
where name='d';
Re: How to find the 4th maximum sal? [message #371015 is a reply to message #371008] Tue, 08 August 2000 09:18 Go to previous messageGo to next message
Vjeko
Messages: 15
Registered: August 2000
Junior Member
The solution with rownum is valid only if inserting into table was order by salary. If insertin was in some random way it won't work fine because ROWNUM returns a number indicating the order in which ORACLE selects the row from a table or set of joined rows. It is not affected by ORDER BY clause.

The best way to find the 4th maximum sal would be using PL/SQL. Of couse, it can be done in SQL but it would be an ugly statment.
Re: How to find the 4th maximum sal? [message #371062 is a reply to message #371012] Mon, 21 August 2000 05:28 Go to previous message
Gopal
Messages: 23
Registered: June 1999
Junior Member
my dear you are apsolutely right.
Previous Topic: util_file package
Next Topic: Re: Oracle knowing person
Goto Forum:
  


Current Time: Sat Oct 31 21:05:49 CDT 2020