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 / tusar
select distinct (a.sal),empno from emp a
where &N = (select count (distinct(b.sal))
from emp b where a.sal <= b.sal);
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What do you understand by integration services in sql server?
Can we linked SharePoint to a SQL database?
Can we join two tables without primary key?
What is extended stored procedures?
What is for xml in sql server?
What are the advantages of partitioning?
What is difference between oltp and olap?
What are types of subqueries?
Explain what are the database objects? : SQL Server Architecture
what are the different ways to return the rowcount of a table?
What is a subquery in a select query statement in ms sql server?
Which is better statement or preparedstatement?
what is the primary use of the model database? : Sql server administration
What is nested transaction?
if no size is defined while creating the database, what size will the database have? : Sql server administration