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 to set a database state to offline in ms sql server?
You accidentally delete the msdb database what effect does this have on your existing sql databases, and how do you recover?
I have all the primary data files, secondary data files as well as logs. Now, tell me can I still restore the database without having a full backup? : sql server database administration
How to change the system date and time from SQL Plus Terminal ?
Explain Active/Active and Active/Passive cluster configurations?
plz tell me the new features of sqlserver2000,sqlserver2002,sqlserver2005
About DTS usage ?
What is the difference between distinct clause and group by clause?
How to create a local temporary stored procedure?
how we can count records as a group of days like sum of records for(four mondays),(four tuesday)........ in a month. group the column for weekdays.
What is sql profiler. What are the default templates with it? : sql server database administration
What is multi-statement table-value user-defined function?