Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
hiselect top 5 salaired employee eg:a= 1500b=1250c=1200d=1150e=200thanxsdatabase
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 dataDECLARE @Test TABLE (EmployeeID VARCHAR(1), EmployeeSalary INT)INSERT @TestSELECT 'a', 1500 UNION ALLSELECT 'b', 1250 UNION ALLSELECT 'c', 1200 UNION ALLSELECT 'd', 1150 UNION ALLSELECT 'e', 200 UNION ALLSELECT 'f', 150-- Do the workSELECT TOP 5 EmployeeID, EmployeeSalaryFROM @TestORDER BY EmployeeSalary DESC