Sunday 15 July 2012

mysql - Copying One column from table to another table that has matching variables in another column -



mysql - Copying One column from table to another table that has matching variables in another column -

i hope can explain create sense lol.

i trying re-create variables 1 hats_old.red hats_new.red match hats_new.name in both tables, if not match need nil not null value or set 0.

this far ive gotten. changes unmatched 0 trying avoid , cannot figure rest out. mysql

thank you

update hats_new set hats_new.red = ( select hats_old.red hats_old hats_old.name = hats_new.name limit 1 );

an update join should trick:

update hats_new hn bring together hats_old ho on hn.name = oh.name set hn.red = ho.red

mysql multiple-columns copying exact-match

No comments:

Post a Comment