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
Mention the differences between having and where clause.
Can you create a logon trigger in sql server 2005 express edition?
Can you roll back the ddl statement in a trigger?
How column data types are determined in a view?
on line cluster can we make if yes tell me the procedure
What do you mean by recursive stored procedure?
where can you add custom error messages to sql server? : Sql server administration
What is a table called, if it has neither cluster nor non-cluster index? What is it used for?
How to select true false based on column value in sql server?
How to stop log file growing too big?
What is resultset concur_updatable?
List few advantages of stored procedure.
Can you name some of the dml commands in sql?
Explain Geography datatype in SQL Server
How to filter records of table in SQL SERVER?