簡體   English   中英

Mysql存儲過程錯誤

[英]Mysql Stored Procedure Error

請需要幫助:

DELIMITER $$

CREATE PROCEDURE `getTodayCheckOuts`
BEGIN
    SELECT `tec_check_out`.`date`,`tec_check_out_items`.`check_out_id`,`tec_check_out_items`.`item_id`,CONCAT(`tec_items`.`name`,' - ',`tec_items`.`code`) AS 'name',SUM(`tec_check_out_items`.`quantity`) AS 'totla_qty',SUM(`tec_check_out_items`.`quantity`*`tec_check_out_items`.`price`) AS 'total_price'
    FROM `tec_check_out_items`, `tec_items`, `tec_check_out`
    WHERE `tec_check_out_items`.`item_id`=`tec_items`.`id`
    AND `tec_check_out_items`.`check_out_id`=`tec_check_out`.`id`
    AND DATE(`tec_check_out`.`date`) = DATE(NOW())
    GROUP BY `tec_check_out_items`.`item_id`
END $$

DELIMITER ;

不斷收到此錯誤

Error
Static analysis:
2 errors were found during analysis.

Unrecognized data type. (near "." at position 163)
Unrecognized data type. (near "," at position 176)

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BEGIN
    SELECT `tec_check_out`.`date`,`tec_check_out_items`.`check_out_id`,`tec_' at line 2

更改:

/*
CREATE PROCEDURE `gettodaycheckouts`
*/

通過:

CREATE PROCEDURE `gettodaycheckouts`()

/*
GROUP BY `tec_check_out_items`.`item_id`
*/

通過:

GROUP BY `tec_check_out_items`.`item_id`;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM