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-26 : 13:18:42
|
| How can I bring back all rows of 1 userID, 1 userID at a time.For example I would like to bring back 2 rows of 497 first, then next time it would be run it would bring back 680 all three rows. (after I delete the previous ID of course)UserID ThumbID497 1497 2680 2680 1680 31111 21111 11111 31268 21268 11268 31562 3Thanks guys!Edited by - mike123 on 02/26/2002 13:19:07 |
|
|
lfmn
Posting Yak Master
141 Posts |
Posted - 2002-02-26 : 13:45:33
|
Why not use a cursor? (don't tell nr) declare @userid intDeclare userid_cursor CURSOR FOR select distinct userid from table1OPEN userid_cursorFETCH NEXT FROM userid_cursor into @useridWHILE @@FETCH_STATUS = 0BEGIN select * from table1 where userid = @userid/*process your data*/delete table1 where userid = @useridFETCH NEXT FROM userid_cursor into @useridENDCLOSE userid_cursorDEALLOCATE userid_cursorSQL is useful if you don't know cursors :-) |
 |
|
|
|
|
|