这在第一个SELECT上引发语法错误-为什么?
CREATE DEFINER=`root`@`localhost` PROCEDURE `get_cand_by_pos_skill`(IN id INT)
BEGIN
SELECT * FROM candidates
WHERE cid = ANY(SELECT candid FROM positionskills p, candidate_skills s WHERE p.positionid = id and s.skillid = p.skill);
END
答案 0 :(得分:0)
$$
以外的其他内容(例如:;
)。最后,重新定义为;
JOIN .. ON
的语法。IN
,而不是= ANY
:请尝试以下操作:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `get_cand_by_pos_skill`(IN id INT)
BEGIN
SELECT *
FROM candidates
WHERE cid IN (SELECT candid
FROM positionskills p
JOIN candidate_skills s ON s.skillid = p.skill
WHERE p.positionid = id);
END $$
DELIMITER ;