MySQL Forums
Forum List  »  Triggers

Re: trigger with condition
Posted by: Peter Brawley
Date: November 29, 2013 12:27PM

Two problems ...

1. The Trigger is defined on sourcetable but the Update statement fails to refer to it.

2. The Join is missing a joining condition.

Some logic is missing from your description, so I can only guess at the solution, something like ...

CREATE TRIGGER ‘sync’ AFTER UPDATE ON sourcetable FOR EACH ROW
BEGIN
  UPDATE db_destination.table_content d
  JOIN sourcetable s ON d.destination_id=s.source_id
  SET d.introtext = s.introtext 
  WHERE d.destination_id = NEW.source_id;
END;
Read the manual page for Triggers to see how to use NEW and OLD.

Options: ReplyQuote


Subject
Views
Written By
Posted
2355
November 29, 2013 07:01AM
Re: trigger with condition
1193
November 29, 2013 12:27PM
1162
November 29, 2013 02:21PM
1131
November 30, 2013 04:03PM
1205
November 30, 2013 11:37PM
1066
December 01, 2013 03:52AM
1055
December 01, 2013 01:46PM
1095
December 01, 2013 03:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.