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 |
|
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2009-07-15 : 11:47:18
|
| Hi i need to work out a way for adding in a seq_no for a references number. I can have multiple references number what i need is like the below so the ref & seq_no are unique.ref_no seq_no 1 11 22 12 22 33 14 14 25 1 5 2 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-07-15 : 12:50:06
|
| [code]SELECT ref_no,ROW_NUMBER() OVER (PARTITION BY ref_no ORDER BY ref_no) AS seq_no FROM Table[/code] |
 |
|
|
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2009-07-16 : 04:47:19
|
| HEY CAN I USE ROW_NUMBER() IN A UPDATE STATEMENT ? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-07-16 : 05:05:01
|
UPDATE fSET seq_no = recidFROM (SELEC seq_no, row_number() Over (partition by ref_no order by ref_no) as recid) AS f N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|