0
語法或查詢有什麼問題?MYSQL查詢錯誤
SET @q=1000;
SET @p=5.00;
SELECT @ccount := COUNT(*) FROM 1detail WHERE price>[email protected];
if(@ccount='0') THEN
INSERT INTO 1detail (price,quantity) VALUES (@p,@q);
ELSE
INSERT INTO 2detail (price,quantity) VALUES (@p,@q);
END IF;
它給我的錯誤:
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 'if(@ccount='0') THEN INSERT INTO 1detail (price,quantity) VALUES (@p,@q)' at line 1:
要創建表(也正在):與數字開始
CREATE TABLE 1detail
(
quantity int,
price DECIMAL(15,2)
);
CREATE TABLE 2detail
(
quantity int,
price DECIMAL(15,2)
);
INSERT INTO 1detail
(quantity, price)
VALUES
('5', '10');
是一個函數或過程或觸發器這裏面的代碼? –