MySQL Forums
Forum List  »  Triggers

Re: update other row in same table
Posted by: William Chiquito
Date: October 22, 2006 11:30AM

Hi Christian,

Maybe a trigger as following you it can be useful:

DELIMITER $$

DROP TRIGGER `bustatuses`$$

CREATE TRIGGER `bustatuses` BEFORE UPDATE ON `statuses`
FOR EACH ROW
BEGIN
SET NEW.stop = OLD.start;
END$$

DELIMITER ;

UPDATE `statuses` SET `start` = NOW() WHERE `id` = [oldId];

Options: ReplyQuote


Subject
Views
Written By
Posted
2472
September 29, 2006 08:43AM
Re: update other row in same table
1788
October 22, 2006 11:30AM


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.