• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 564
  • Last Modified:

Copy data from table1.column1 to table2.column2 where table1.id = table2.id

Hi All,
Using MySQL 4
I have to copy data from
 table1.column1 to table2.column2 where table1.id = table2.id

Will appreciate if someone could please give me the exact syntax for mysql 4.

Thanks in advance
1 Solution
Jinesh KamdarCommented:
Try this.

UPDATE table2 t2
SET column2 = (SELECT column1 FROM table1 WHERE id = t2.id)
WHERE EXISTS (SELECT 1            FROM table1 WHERE id = t2.id);
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now