Created
May 8, 2013 09:14
-
-
Save gabrieledarrigo/5539264 to your computer and use it in GitHub Desktop.
An Sql trigger example.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
CREATE TRIGGER ai_photogallery AFTER INSERT ON photogallery_item | |
FOR EACH ROW | |
BEGIN | |
UPDATE photogallery_master | |
SET file = | |
(SELECT file FROM photogallery_item WHERE id_photogallery = NEW.id_photogallery ORDER BY ordine DESC LIMIT 1) | |
WHERE id = NEW.id_photogallery; | |
END; | |
$$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment