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.
July 10, 2012 at 11:37 am
thanks bro it worked.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy