Click here to Skip to main content
15,891,629 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have one table: employee
fields are:
emp_id
emp_name
emp_salary


I want 10 employee list whose salary is highest.
please help me.
Posted

try this....

SQL
select a.client_id as client_id,b.city_name as city_name,a.client_name as client_name from client a inner join
city b on a.city_id=b.city_id where a.city_id=@city_id
 
Share this answer
 
use this...
SQL
select * from
(
    select emp_id,emp_name,emp_salary, Rank() over (order by emp_Salary desc) as Sal_Rank
    from employee
)
as temp where Sal_Rank<=10 
Order by Sal_Rank, Emp_Id

this will give employees list having top 10 highest salaries.
e.g...
empid  name      sal     sal_rank
----------------------------------
1      samarth   100000  1
2      aadarsh   100000  1
5      tarak     90000   2
...

Happy Coding!
:)
 
Share this answer
 
v2
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 21-Dec-12 1:45am    
link formatted.
hi friend,
Please try this
SQL
select top 10 salary from dbo.Employee_Master order by salary DESC
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 21-Dec-12 1:45am    
Code block added.
try this
SQL
Select top 10 * from employee
order by emp_salary desc
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 21-Dec-12 1:45am    
Code block added
Namaskar(Hi)
You can try this:
SQL
select top 10 * from emp order by empsal desc
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 21-Dec-12 1:45am    
Code block added

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900