How to update or add to table1 where email = table2.email?

[expired user #1919]'s profile image [expired user #1919] posted 16 years ago in General Permalink
How to update or add to table1 where email = table2.email?
UPDATE 'table1' SET 'field1' WHERE 'email' = 'table2.email'


I don't think this is at all right but can't update or add data from new table?

Cheers
ansgar's profile image ansgar posted 16 years ago Permalink
Try this:
ALTER TABLE table1 ADD field1 VARCHAR(255);
UPDATE table1 AS t1, table2 AS t2 SET t1.field1=t2.field1 WHERE t1.email = t2.email;
[expired user #1919]'s profile image [expired user #1919] posted 16 years ago Permalink
Wow that's amazing! happy

Thank you! :)

Please login to leave a reply, or register at first.