How to find the second largest salary in the emp database and
also How to find 3rd,4th and so on ........ in the emp database
plz mail the answer @ mak2786@gmail.com
Answer Posted / g
TO FIND THE 3rd,
select max(sal) from emptable where salary not in(select
distinct top 2 sal from emptable)
TO FIND THE 4th,
select max(sal) from emptable where salary not in(select
distinct top 3 sal from emptable)
TO FIND THE 5th,
select max(sal) from emptable where salary not in(select
distinct top 4 sal from emptable)
keep change top value...
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Explain throw statement in sql server 2008?
What are the different authentication modes in sql server? How can it be changed?
How to end a stored procedure properly in ms sql server?
What is nonclustered index on computed columns?
What is the difference function and stored procedure?
Ms sql server index?
How do I view a stored procedure in sql server query?
How to create a dml trigger using create trigger statements?
How to assign null values to variables or columns?
What is sql injection? How to protect against sql injection attack?
what is the Ticketing tool used in Wipro technologies at Bangalore...???
What is the difference between cube operator and rollup operator? : SQL Server Architecture
What is scheduled job and how to create it?
Why use stored procedures in sql server?
What are temporal tables in sql server 2016?