Home » RDBMS Server » Server Administration » queries
queries [message #374416] Mon, 11 June 2001 05:43 Go to next message
Raj
Messages: 411
Registered: November 1998
Senior Member
query
for second maximum salary in employee table
or nth maximum salary in employee table
Re: queries [message #374480 is a reply to message #374416] Thu, 14 June 2001 04:59 Go to previous messageGo to next message
Thirumalai and Prakash
Messages: 23
Registered: March 2001
Junior Member
Hi Raj,

The query to find nth maximum is

select min(f) from (select distinct f from tbl order by f desc ) where rownum < &n + 1

Where, f is field and tbl is table name.

Regards
S.Thirumalai
Re: queries [message #374481 is a reply to message #374416] Thu, 14 June 2001 05:02 Go to previous message
Thirumalai and Prakash
Messages: 23
Registered: March 2001
Junior Member
Hi Raj,

The query to find nth maximum is

select min(f) from (select distinct f from tbl order by f desc ) where rownum < &n + 1

Where, f is field and tbl is table name.

Regards
S.Thirumalai
Previous Topic: SQL statement
Next Topic: String concat in CopyCommit statement ( in Oracle 8i)
Goto Forum:
  


Current Time: Thu Jul 04 21:48:12 CDT 2024