I'm not an expert in this and have a task to solve that for me seems not that easy.
I'm having two databases with tables. structure is identical.
Now I want to copy (with an UPDATE) only one field of one row (specific source id will stay the same) to th eother row in the destination table (also here one fixed id which wil stay the same) if it has been changed.
So I setup the trigger on the source db and coded this:
create TRIGGER ‘sync’ AFTER UPDATE ON sourcetable
FOR EACH ROW
UPDATE db_destination.table_content custom_destination
INNER JOIN db_source.table_content custom_source
SET custom_destination.introtext = custom_source.introtext
WHERE custom_destination.id = 2 AND custom_source.id = 1;
It is working fine...but it updates always by the meaning of it updates even if I have not edited the one source from row with id = 1. If I edit for example on id = 15 in source table the UPDATE statemnt gets triggered and updates destination with id = 2 from source with id = 1.
How can I avoid this that it only triggers when source id =1 has been changed?
Thanks a lot for any support.
Edited 1 time(s). Last edit at 11/29/2013 08:12AM by Martin Tomczyk.