I have 3 tables: the first one gets all records to the t1 table, the second one is where my whitelist entries are, and the third one is for making some decision in the future regarding to t2. I need to create after insert trigger an update via my third table. the steps :
- some value come into the tables called "t1"
- need to check if the value is in "t2"
- if the value is in t2 so go to t3 and do something, if the value is not in t2 so go to t3 and do something else.
- but the value will always need to enter t1.
This is my code and it does not work, I don't know how to apply it I've tried many options already.
CREATE TRIGGER check_whitelist AFTER INSERT ON t1
FOR EACH ROW
SELECT
IF(IFNULL(new.name=(
select name From t2 where (t2.name = new.name),
UPDATE t3 SET option1 =0 ,
UPDATE t3 SET option2 =1
)))
Please help me with writing this code.