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)
 Selecting highest values

Author  Topic 

hasanali00
Posting Yak Master

207 Posts

Posted - 2005-04-23 : 12:37:14
hi
If I have a table like

id username points
1 user1 22
2 user1 18
3 user1 30
4 user2 10


I want to return upto 2 rows for each user which have the highest points.

SO for user1, I want to return rows 1 & 3
For user2, I want to return row 4.

Would be grateful, if u can tell me how to do this.
regards

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-04-23 : 13:18:01
This topic provides a solution to that exact question:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=48794

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -