write the query for find the top 2 highest salary in sql
server
Answers were Sorted based on User's Feedback
Answer / uday
select * from Emp e where 1=(select count(Distinct
d.esal)from emp d where d.esal>e.esal)
i am sure that it should work.
Any thing wrong plz inform me
| Is This Answer Correct ? | 5 Yes | 9 No |
select max(salary)from emp where salary <(select sum(salary)
from emp)
| Is This Answer Correct ? | 6 Yes | 12 No |
Answer / santhosh kumar
select Distinct Top 2 Salary from EMP order by Salary desc
| Is This Answer Correct ? | 7 Yes | 15 No |
Answer / sivashankar.soma
select ename,sal from emp E where 1=(select count(*) from
emp where E.sal<sal)
| Is This Answer Correct ? | 16 Yes | 29 No |
What does select 1 mean?
What is the difference between function and stored procedure in sql server?
Which institute is best for SQL Server 2005 Training?
What does dml stand for?
What are the types of backup and tell me the difference between full and differential backup?
Can a stored procedure call itself or recursive stored procedure? How many levels sp nesting is possible?
explain different types of jions with examples briefly?
2 Answers Accenture, Excellence, Zensar,
What is the use of partition by in sql server?
How to get max 100 values from sql server
When columns are added to existing tables, what do they initially contain?
Once setting replication, can you have distributor on sql server 2005, publisher of sql server 2008?
What should be the fill factor for indexes created on tables? : sql server database administration
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)