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
2597
November 29, 2013 07:01AM
Re: trigger with condition
1305
November 29, 2013 12:27PM
1280
November 29, 2013 02:21PM
1242
November 30, 2013 04:03PM
1296
November 30, 2013 11:37PM
1160
December 01, 2013 03:52AM
1142
December 01, 2013 01:46PM
1206
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.