codlib — 2011-11-03T01:28:59-04:00 — #1
I have two mysql tables 'letter' and 'lettercopy' letter will daily populated with records. Lettercopy is a copy of letter table and once in a week it should copy the new records from letter to lettercopy. The records in letter will not get updated or deleted once inserted. I am looking for some kind of incremental copy. Can anyone tell me how the SQL should be. I tried insert ignore but it is not working.
Below is my table syntax. PFA the screenshot
I have tried the below SQL. But it is not working
INSERT INTO lettercopy (lid, alpha) SELECT letter.id as lid, letter.name as alpha FROM letter WHERE NOT EXISTS ( SELECT * FROM lettercopy WHERE lid = ( SELECT id FROM letter))
guido2004 — 2011-11-03T05:15:19-04:00 — #2
Make lid PK.
r937 — 2011-11-03T06:19:49-04:00 — #3
i'm sorry, i cannot guess
would you please show the actual error message