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 |
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2011-10-25 : 23:10:05
|
| declare @a table(col1 smallint, col2 char(2))insert into @a select1,'p' union all select1,'a' union all select1,'q' union all select2,'c' union all select2,'d' union all select2,'e' union all select3,'fa' union all select3,'p' union all select4,'p' union all select5,'ga';'p' is priority.desire output1,'p'2,'c' <--- any record will do...not necessary must be 'c'3,'p'4,'p'5,'ga' |
|
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2011-10-25 : 23:55:18
|
| done with row_number |
 |
|
|
|
|
|
|
|