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))