i'm really new to mysql triggers so...i have 3 tables: a,b and c. table a is related with table b with a one to many relaion and table c is the table that get the triggered infromation from the 2 other tables.
table a
------------------
id | name
1 | Juan
2 | Pete
3 | David
table b
----------------------
id | name | table_a_id
1 | Dog | 1
2 | Cat | 2
Table C gets the information from Table A with a "after insert on A for each row insert into C "also gets information From table B with a "after insert on B for each row update C".
table c
----------------------
id | name a | name b | table_a_id |table_b_id
1 | juan | Dog | 1 | 1
2 | Pete | Cat | 2 | 2
The problem occurs when Pete wants to have Cat and Dog at the same time because it will just update Pete's information. What i want is a way in which i can have a new row with all the information.
table c
-------------------------------------------
id | name a | name b | table_a_id |table_b_id
1 | juan | Dog | 1 | 1
2 | Pete | Cat | 2 | 2
---->3 | Pete | Dog | 2 | 1
This 3rd row from table C wont be created it will just update row 2 from table C. Please tell e if i was clear enough.
INSERT .. ODKU
and/orREPLACE
are available? – Akina Mar 21 '19 at 17:03