I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000

Answer Posted / bennison terry

Select Top 1 * from Tbl_Salary where ID not in (Select top 1 ID from tbl_salary order by salary desc) order by Id desc

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a data collection table?

542


What is side by side migration in sql server?

538


Explain full-text indexing?

516


Explain the flow of creating a cube? : sql server analysis services, ssas

627


What is difference between delete & truncate commands?

550






What is data set in report?

97


Find columns used in stored procedure?

529


What stored procedure would you use to view lock information?

528


What are entities and relationships?

558


What happens if null values are involved in boolean operations?

556


What is 2nf normalization?

541


How use inner join in sql server?

617


How do use Having,Group by,Group function in SQL?

1358


Explain the working of sql privileges?

611


What is a natural primary key?

524