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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-11-02 : 07:19:38
|
| ned writes "Hi,How can I set up a query to group the employees by district, but just take the top 3 employees from each district? Thx" |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-11-02 : 07:43:14
|
something like:Select id, comment, districtFrom myTable as t1Where (Select count(distinct district) from myTable Where id = t1.id and district >= t1.district) <= 3Order By id, district descGo with the flow & have fun! Else fight the flow |
 |
|
|
|
|
|