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 2005 Forums
 Transact-SQL (2005)
 query question

Author  Topic 

aikman
Starting Member

22 Posts

Posted - 2008-07-07 : 10:25:25
Hi

i need to do a query to get top 5 sales from a table. table looks like this

id pers_id salery bonus totalsal sal_period
1 1 10000 1017 11017 2005-2006
2 2 10000 978 10978 2005-2006
3 5 10000 972 10972 2005-2006
4 6 10000 1048 11048 2005-2006
5 7 10000 1013 11013 2005-2006
6 10 15000 1005 16005 2005-2006
7 13 15000 978 15978 2005-2006


i need to do a query to get top 5 sales persons from bonus colum

Thanks for help

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-07 : 10:27:00
[code]select top 5 *
from table
order by totsal desc[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -