HI Peter,
ok. I changed some stuff and hopefully done it right :)
The JOIN and my whole concept were wrong I think. I would have needed a full outer join anyway (If I'm right :))
But I started to go the direction you leaded me to with NEW extension of TRIGGER.
So the new code doing it's job the way I want to.
Maybe you could give some comments. I would really appreciate it.
To summarize the task:
#####################DB-SOURCE#####################| |################DB-DESTINATION###################
#source table (structure identical to destination)#| |####table (structure identical to source)########
#_______id______|_______introtext_________________#| |#______id______|___introtext____________________#
# 1 | varchar of id1 in source #|---| |# 1 | varchar of id1 in destination#
# 2 | varchar of id2 in source #| |------->|# 2 | varchar of id2 in destination#
# 3 | varchar of id3 in source #| |# 3 | varchar of id3 in destination#
The only thing that should happen when the trigger fires is that
only the introtext of id=1 in source table
should be copied to
the introtext of id=2 in destination table
And that only if introtext of id=1 in source table is changed.
In any other cases nothing happens. So the code is:
BEGIN
IF NEW.id = 1 THEN
UPDATE db_destination.table_content custom_destination
SET custom_destination.introtext = NEW.introtext
WHERE custom_destination.id = 2;
END IF;
END
Thanks a lot.
Martin
Edited 1 time(s). Last edit at 11/30/2013 04:16PM by Martin Tomczyk.