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 / prasant palo
with ttble as
(
select top 3 empid,empname,empsalary
from
emptable
order by empsalary desc
)
-- above will create a common table expression with name
--ttable
-- to know about it search for commontable expression
select top 1 empid,empname,empsalary
from
ttable
order by empsalary asc
| Is This Answer Correct ? | 2 Yes | 5 No |
Post New Answer View All Answers
Explain trigger and trigger types?
What is ddl command?
How will you find out if there are expensive SQL statements running or not?
Can a stored procedure call itself or recursive stored procedure? How much level sp nesting is possible?
Explain the functionalities that views support?
What is policy management?
What is the difference between for trigger and after trigger?
Stored Procedure returns data from multiple tables. How to access it in your ASP.Net code?
Is ssrs support other database except ms sql server?
How to create “dependant” parameter “make, model, year”
How to find table changes in sql server?
can an automatic recovery be initiated by a user? : Sql server administration
What is the syntax to execute the sys.dm_db_missing_index_details?
Does an index slow down updates on indexed columns?
Can a stored procedure call itself or a recursive stored procedure? How many levels of sp nesting is possible?