[英]MySQL error #1064 while creating stored procedure
Here is the code: 这是代码:
IF(selected_item_id IS NOT NULL AND selected_category IS NOT NULL) THEN
IF(selected_item_id <> "all") THEN
SELECT i.id, i.name, i.summary, i.description, i.location, c.name AS 'category_name' FROM items i, categories c WHERE i.category_id = c.id AND i.id LIKE selected_item_id;
ELSE IF(selected_item_id = "all" AND selected_category <> "all" AND selected_category in (SELECT name FROM categories)) THEN
SELECT i.id, i.name, i.summary, i.description, i.location, c.name AS 'category_name' FROM items i, categories c WHERE i.category_id = c.id AND c.name LIKE selected_category;
ELSE IF(selected_item_id = "all" AND selected_category = "all") THEN
SELECT i.id, i.name, i.summary, i.description, i.location, c.name AS 'category_name' FROM items i, categories c WHERE i.category_id = c.id;
END IF
END IF
When I try to save it, I get : 当我尝试保存它时,我得到:
MySQL Said: #1064 near 'END IF' at line 17 (that's the last END IF) MySQL说:#1064在第17行的“ END IF”附近(这是最后一个END IF)
Help is much appreciated. 非常感谢您的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.