Page 1 of 1

Updating 1 table from another table.

Posted: Sat Sep 23, 2006 8:59 pm
by ron_j_m
Heres the situation.
I have 2 tables. Table1 and Table2.
I would like to update Table1 with fields from Table2.
So if Table1 Field1 contained May and June,
and Table2 Field2 contained July and September after updating Table1 I would like Field1 to contain May, June, July and September.

Here is what I have been trying with no luck of course.

Code: Select all

'UPDATE Table1 LEFT JOIN Table2 ON Table1.Field1 = Table2.Field1 SET Table1.Field1=Table2.Field1 WHERE Table1.Field1 IS NULL'
Ive been reading and searching all over but there must be something Im just not getting.
Any Ideas..
Thanks
Ron

Posted: Sat Sep 23, 2006 10:00 pm
by ron_j_m
Ive found somthing that seems to work.

Code: Select all

insert ignore into table1 select * from table2
Is there a better way to do this?

Thanks
Ron