0
這是一個簡單的觸發我試圖創建:錯誤創建觸發器
CREATE TRIGGER add_item_id BEFORE INSERT ON products
FOR EACH ROW
BEGIN
DECLARE max_id INTEGER;
SELECT MAX(item_id) INTO @max_id FROM products;
SET NEW.item_id = @max_id + 1;
END;
我想它無論在phpMyAdmin的SQL窗口和MySQL提示,並得到了同樣的錯誤如下:
#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 4