Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 select top 5 salaired employee

Author  Topic 

oracle_corrgi
Yak Posting Veteran

98 Posts

Posted - 2006-09-19 : 07:22:25
hi
select top 5 salaired employee

eg:
a= 1500
b=1250
c=1200
d=1150
e=200

thanxs

database

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-19 : 07:29:18
Yes! Your query worked.

Or is it this you want?
-- Prepare test data
DECLARE @Test TABLE (EmployeeID VARCHAR(1), EmployeeSalary INT)

INSERT @Test
SELECT 'a', 1500 UNION ALL
SELECT 'b', 1250 UNION ALL
SELECT 'c', 1200 UNION ALL
SELECT 'd', 1150 UNION ALL
SELECT 'e', 200 UNION ALL
SELECT 'f', 150

-- Do the work
SELECT TOP 5 EmployeeID,
EmployeeSalary
FROM @Test
ORDER BY EmployeeSalary DESC

Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -