I know about ON DUPLICATE USE KEY
clauses. But I can not use it since I want to update
and insert
on non-unique column.
I have table1
and table2
. I want to create a trigger on table1
.
Pseudocode:
IF id_code for corresponding id_name from table1 is present in table2
then update record in table 2
else record in table2.
For Ex.
table1 has column1 id_code, column2 id_name
table2 has column1 id_code, column2 status
IF id_code for corresponding id_name from table1 is present in table2
UPDATE status column in table2.
ELSE insert id-code in table2