Dynamic Update Statement

ismailr

Registered User.
Local time
Today, 04:07
Joined
Oct 16, 2015
Messages
31
Hi,
Can someone help to update Table3.

I have three table with data;

Table1

RECID NewCode
1000 RA1
1001 RD1
1002 RC1

Table2
RECID OldCode
1000 RA3
1001 RD0
1002 RC1

Table3
CoCode
RD0
RA3
RC1

I need to create a dynamic update statement to update Table3.CoCode with NewCode from Table1.

thanks
Ismail
 
UPDATE table3 INNER JOIN ((SELECT table1.NewCode, table2.OldCode FROM Table1 INNER JOIN table2 ON table1.RecID = table2.RecID) AS T1) ON table3.CoCode = T1.OldCode SET table3.CoCode = T1.NewCode;
 
Perfect, Thanks you Sir. Ismail
 

Users who are viewing this thread

Back
Top Bottom