DELIMITER //
CREATE TRIGGER sample_index
AFTER INSERT ON qa_quantifiers_box_float
FOR EACH ROW BEGIN
IF (
SELECT 1 = 1
FROM `qa_quantifiers`
WHERE `type`='PERCENTAGE'
and Id<>8
and Id=NEW.q_id
) THEN
update qa_labels_box_gen qa set `SampleIndex`=(SampleIndex+NEW.score) WHERE NEW.qlb_id=Id;
END IF;
END;
DELIMITER;
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 11
What?
EDIT:
Got it to work thanks to ÁlvaroGonzález comment :
what i didnt know is that when using ; inside mysql code i needed to change the delimeter to // and use it after i define the trigger :
DELIMITER //
CREATE TRIGGER sample_index
AFTER INSERT ON qa_quantifiers_box_float
FOR EACH ROW BEGIN
IF (
SELECT 1 = 1
FROM `qa_quantifiers`
WHERE `type`='PERCENTAGE'
and Id<>8
and Id=NEW.q_id
) THEN
update qa_labels_box_gen qa set `SampleIndex`=(SampleIndex+NEW.score) WHERE NEW.qlb_id=Id;
END IF;
END;
//