Commit 01bf65b6 authored by M1888's avatar M1888

trigger v2

parent c22c55fb
...@@ -268,15 +268,15 @@ ENGINE = InnoDB; ...@@ -268,15 +268,15 @@ ENGINE = InnoDB;
-- ------------------------- -- -------------------------
-- Sama trigger, kun ylempi constraint. Vaan ei toimi tämäkään. -- Sama trigger, kun ylempi constraint.
DELIMITER // DELIMITER //
CREATE TRIGGER `vain_yksi_tapahtuma_ins` BEFORE INSERT ON `ottelutapahtuma` CREATE TRIGGER `vain_yksi_tapahtuma_ins` BEFORE INSERT ON `ottelutapahtuma`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF ((CASE WHEN aikalisa_id IS NULL THEN 0 ELSE 1 END) + IF ((CASE WHEN NEW.aikalisa_id IS NULL THEN 0 ELSE 1 END) +
(CASE WHEN jaahy_id IS NULL THEN 0 ELSE 1 END) + (CASE WHEN NEW.jaahy_id IS NULL THEN 0 ELSE 1 END) +
(CASE WHEN rankkari_id IS NULL THEN 0 ELSE 1 END) + (CASE WHEN NEW.rankkari_id IS NULL THEN 0 ELSE 1 END) +
(CASE WHEN maali_id IS NULL THEN 0 ELSE 1 END) != 1) THEN (CASE WHEN NEW.maali_id IS NULL THEN 0 ELSE 1 END) != 1) THEN
CALL `ottelutapahtuma_liikaa_tapahtumia`; CALL `ottelutapahtuma_liikaa_tapahtumia`;
END IF; END IF;
END// END//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment