Unexpected update count received. Changes will be rolled back. SQL: DELETE FROM `myproject`.`role_module` WHERE `role_id` = ? AND `module_id` = ?

技术分享图片

数据库中存在重复数据,想要通过控制台 "-" 操作删除或者sql语句

 

DELETE FROM role_module WHERE role_id = 500 AND module_id=600;

 

删除 重复数据,两者执行结果相同,都会是:

Unexpected update count received. Changes will be rolled back. SQL: DELETE FROM `myproject`.`role_module` WHERE `role_id` = ? AND `module_id` = ?

 

因为执行 "-" 和语句对应的行数都是一行,而表中却有多条数据符合条件,因此数据库不知道该怎样执行了,因此不能执行而报错.

解决的办法就只将条件上一级删除(DELETE FROM role_module WHERE role_id = 500;).

文章来自:https://www.cnblogs.com/luke-liuqi/p/9369825.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3