我收到以下错误
1064-您的SQL语法有误;查看与您的MySQL服务器版本相对应的手册以使用正确的语法
靠近'作为BEGIN SELECT count(CustomerFeed.overall),坐于FROM
2号线的ContactCenter L'
当我运行此语句时。
DELIMITER //
CREATE PROCEDURE GetAllProducts2(IN location VARCHAR(100),
IN start1 TIMESTAMP,
IN end1 TIMESTAMP)
BEGIN
SELECT count(CustomerFeed.overall) AS sat
FROM ContactCenter
LEFT JOIN CustomerFeed
ON ContactCenter.callId = CustomerFeed.callId
WHERE date(ContactCenter.callClose) BETWEEN start1 AND end1
AND ContactCenter.callStatus = 'Close'
AND CustomerFeed.overall IN ( 1, 2 )
AND ContactCenter.location = location
AND ContactCenter.gNum != '';
END //
DELIMITER;
最佳答案
不要在MySql的stored procedure definition中使用AS
关键字。因此将其删除。
DELIMITER //
CREATE PROCEDURE GetAllProducts2(IN location varchar(100),
IN start timestamp,
IN end timestamp)
BEGIN
...
END //
DELIMITER ;