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 / elumalai.k
select top1 id,salary from employee
where
(salary<(select max (salary) As sal from employee As Empp))
orderby salary desc.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
Which sql server table is used to hold the stored procedure script?
Can you give me some DBCC command options?(Database consistency check) - DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC - To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.
Why should we go for stored procedures? Why not direct queries?
What is self contained scalar sub query?
What is difference between standardization and normalization?
How will you add a dimension to cube? : sql server analysis services, ssas
How to modify existing triggers using "alter trigger"?
How to use the inserted and deleted pseudo tables?
What happens if you add a new index to large table?
can a database be shrunk with users active? : Sql server administration
what is an index? : Sql server database administration
How to use go command in "sqlcmd"?
What is the use of group by clause?
What are indexes in sql?
Can binary strings be used in arithmetical operations?