I have two MySQL tables, here's how they are structured:
table foo(
foo_id varchar(32),
field1 varchar(32),
field2 varchar(32),
bar_id varchar(32)
);
table bar(
bar_id varchar(32),
field1 varchar(32),
field2 varchar(32)
);
I would like to update the foo
table to have the same values for field1
and field2
as the bar
table. I've tried the following two queries, both of which run without error, but don't get me the results I want:
UPDATE foo LEFT JOIN bar ON foo.bar_id = bar.bar_id
SET foo.field1 = bar.field1 AND foo.field2 = bar.field2;
also
UPDATE foo,bar SET foo.field1 = bar.field1
AND foo.field2 = bar.field2 WHERE foo.bar_id = bar.bar_id
but neither work. what am I missing here?