更新问题表后,我需要从响应表中删除行,但出现此错误:子查询返回多行。有没有办法让它工作?
CREATE TRIGGER delete_responses AFTER UPDATE ON questions
FOR EACH ROW
BEGIN
IF NEW.active != OLD.active
THEN DELETE FROM responses WHERE option_id = (
SELECT option_id
FROM options
WHERE question_id = OLD.question_id);