can anybody tell us, how to select 2nd max salary from
table.
my id is ashish.akk@gmail.com
Answers were Sorted based on User's Feedback
Answer / arun ashok
Select max(salary) from employee where salary not in (select
max(salary) from employee)
| Is This Answer Correct ? | 1 Yes | 1 No |
Select top 1 salary from table where salary in(select top 2
salary from table order by salary desc)order by salary
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pravin
select max(sal) from emp
where sal=(select max(sal)
from emp
where sal<(select max(sal)
from emp))
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / syaam
select a.sal from emp a
where 2=(select count(distinct b.sal) from emp b
where a.sal<= b.sal)
for getting nth max sal ..replace 2 by n
all the best
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / swapnl
select max(sal) from emp_det where sal not in (
select max(sal) from emp_det);
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / kumar
1 My Second Answer.
Select Top 1 * From Tablename where salary in
(select top 2 salary from tablename order by salary desc)
order by salary asc.
| Is This Answer Correct ? | 0 Yes | 4 No |
how can u select the Distinct values in the table, table having 20 columns , i want all columns
What are the differences in Clustering in SQL Server 2005 and 2008 or 2008 R2?
Can Somebody tell me the difference between Clustered & Non- Clustered Index??
What are the kinds of subquery?
Why should one not prefix user stored procedures with ‘sp_’?
Can we take the full database backup in log shipping?
How to create a local temporary stored procedure?
What are different types of Keys? Please explain all the keys with a suitable example.
What stored procedure would you use to view lock information?
How to move database physical files in ms sql server?
What are the different types of replication? How are they used?
Explain syntax for dropping triggers?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)