Reputation: 724
I have the following tables:
tbl1:
CC GG GA VALUE
01 NULL NULL 10
02 NULL NULL 22
01 NULL NULL 04
03 NULL NULL 04
tbl2:
CC GG GA
01 aa xx
02 bb yy
03 cc zz
How can I update table 1 GG and GA values from tbl 2, linking by CC?
Upvotes: 0
Views: 103
Reputation: 38147
Try :
UPDATE tbl1,tbl2
SET tbl1.GG = tbl2.GG, tbl1.GA = tbl2.GA
WHERE tbl1.CC = tbl2.CC
I think its pretty self explanatory - but it updates tbl1.GG
to tbl2.GG
and tbl1.GA
to tbl2.GA
where tbl1.CC
equals tbl2.CC
Upvotes: 2