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 |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2002-02-27 : 20:15:08
|
| Ok, im driving myself nuts over thisI want to grab just the top userID. So in this case I would like to bring back the top 3 rows (userID 422), then after I delete those I would like to bring back the 4th and 5th row (both userid 426)userid X Y422 1 1422 2 1422 3 1426 1 1426 2 1435 1 1435 2 1436 2 1I hope you catch my drift.. I swear I had this working and overwrote the SP.... Thanks alot!!! |
|
|
Tigger
Yak Posting Veteran
85 Posts |
Posted - 2002-02-27 : 20:19:42
|
| Does this do what you want?select *from <table name>where userid = (select top 1 userid from <table name>) |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2002-02-28 : 19:46:55
|
| Be sure to add an Order By clause to Tigger's answer.Or, I believe the following also does what you want, without a subquery...SELECT TOP 1 WITH TIES *FROM tblSampleORDER BY UserID------------------------GENERAL-ly speaking...Edited by - AjarnMark on 02/28/2002 19:47:18 |
 |
|
|
|
|
|