Hey i’m trying to update a table and create an insert a row to another table.
I have this update query :
UPDATE logs_month SET status ='1'
WHERE DATE_FORMAT(month,"%m/%y") = '11/12'
And i want it to be something like this:
UPDATE logs_month SET status ='1',
(INSERT INTO some_table (columns) values (values from the updated row))
WHERE DATE_FORMAT(month,"%m/%y") = '11/12'
How can this be done?
I don’t want to use 2 queries because this update can accour several times a month and i want to insert only the rows currently updates to prevent duplicates without using unique indexes.
You can do with TRIGGER also,
You can do like this