View Single Post

   
  #1 (permalink)  
Old 05-10-2008, 02:03 PM
Shane
 
Posts: n/a
Default Merging data in two tables

I need to merge table "B" into table "A" inserting any new records and
updating any existing ones. The two tables are identically formatted,
both with a key of "id" and identical columns.

I can do the insert of new records easily enough with INSERT IGNORE
INTO a (columns...) SELECT (columns...) FROM b.

It is the update of table "a" if, and only if, any column in table "b"
has changed that is stumping me.

I thought this was possible using a merge table, but I may be
incorrect. I have done this successfully in the past, but the exact
process escapes me.

Thanks!
Reply With Quote