我有投票的SQL查询,检查投票是否存在,但它一直给我语法错误
IF EXISTS (SELECT * FROM `votes` WHERE `id` = 298 AND `author` = 'noo
子查询本身运行良好。
IF EXISTS (SELECT * FROM `votes` WHERE `id` = 298 AND `author` = 'noob') THEN
'exist'
ELSE
INSERT INTO `votes`(`id`, `author`, `type`, `value`) VALUES (298, "noob", "upvote", 1)
'upvoted'
END IF