我尝试使用此代码创建存储过程但我无法创建它。 我可以创建一个存储过程,每个删除只有一个,它可以工作。
DELETE FROM mostra WHERE罚款
DELETE FROM spettacolo WHERE id IN( SELECT id_spettacolo 来自spettacolo_teatro WHERE数据< CURDATE();
答案 0 :(得分:1)
您需要修复DELETE语句,但之后您应该能够执行以下操作:
delimiter //
CREATE PROCEDURE your_delete_proc ()
begin
DELETE FROM mostra WHERE fine;
DELETE FROM spettacolo WHERE id IN ( SELECT id_spettacolo FROM spettacolo_teatro WHERE data < CURDATE( ));
END //
delimiter ;