July 10, 2012 at 8:14 am
Hi,
i have a table with following structure
TableA
OldId int,
NewId int
select * from tableA;
OldID NewID
22
23
24
I have another table that holds OldId.
select oldId from TableB;
OldId
10
11
12
now I want to update tableA from TableB, in way that first value of TableB update against first value in TableA.OldId
I am expecting result after that update like following
select * from tableA;
OldID NewID
10 22
11 23
12 24
Is this update can happen without any other criteria ? or how can I do so ?
July 10, 2012 at 8:18 am
Add a Row_Number() column to both (with sorting as you require) and join on that - then the update becomes trivial.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
July 10, 2012 at 11:37 am
thanks bro it worked.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply