MySQL Forums
Forum List  »  Triggers

Re: update trigger to query before inserting into new database
Posted by: William Chiquito
Date: June 25, 2007 08:22AM

Hi William,

Try:
DELIMITER $$

DROP TRIGGER `addinventory `$$

CREATE TRIGGER `addinventory` AFTER UPDATE on `tracking`
FOR EACH ROW
BEGIN
	IF (NEW.tracking_status != OLD.tracking_status) THEN
		INSERT INTO test.trigger (shoppingcartid)
		SELECT trackitem.trackitem_itemnumber FROM trackitem
		INNER JOIN tracking ON trackitem.trackitem_tracknum = OLD.tracking_id;
	END IF;
END$$

DELIMITER ;

Options: ReplyQuote




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.