sql query question
-
Monday, May 30, 2011 4:20 PM
I have the below table and need to update values in row_id column from row_id_old. row_id should have value of row_id_old where sortorder=1. I have shown the output below
ID ROWID ID_OLD ROW_ID_OLD sortorder
1 NULLL 100 10 1
1 NULL 200 32 0
1 NULL 300 23 0
2 NULL 320 42 1
2 NULL 456 39 0
--------------------------------------------
ID ROWID ID_OLD ROW_ID_OLD sortorder
1 10 100 10 1
1 10 200 32 0
1 10 300 23 0
2 42 320 42 1
2 42 456 39 0
All Replies
-
Monday, May 30, 2011 4:24 PM
Update y Set ROWID = y1.ROW_ID_OLD From YourTableName y Inner Join YourTableName y1 On y.ID = y1.ID And y1.sortorder = 1;
Tom- Proposed As Answer by Naomi NMicrosoft Community Contributor, Moderator Monday, May 30, 2011 4:32 PM
- Marked As Answer by sami09 Monday, May 30, 2011 4:34 PM

