日期:2014-05-16  浏览次数:20743 次

mysql在创建存储过程是一直提示的一个语法问题
CREATE   PROCEDURE   Sel_HW_Category(   )   BEGIN   SELECT   *  
FROM   Tbl_hw_Category
WHERE   Cat_Parent   <>   Cat_ID
AND   Cat_Parent
IN   (


SELECT   Cat_ID
FROM   Tbl_hw_Category
)
AND   Cat_ID
IN   (

SELECT   Cat_Parent
FROM   Tbl_hw_Category
)
ORDER   BY   Cat_ID

------解决方案--------------------
delimiter $$
CREATE PROCEDURE Sel_HW_Category()
BEGIN
SELECT * FROM Tbl_hw_Category WHERE Cat_Parent <> Cat_ID
AND Cat_Parent IN ( SELECT Cat_ID FROM Tbl_hw_Category)
AND Cat_ID IN ( SELECT Cat_Parent FROM Tbl_hw_Category)
ORDER BY Cat_ID;
end$$
delimiter ;


(0 row(s)affected)
(0 ms taken)