标签:info 数据 where 产生 class 字段 from set 逻辑
userId 在数据库中为int类型
select * from userinfo where userId = 0
等于
select * from userinfo where userId = ‘‘
当id为int类型,根据id批量(逻辑)删除记录时。
update userinfo set isdel = 1 where userId in(‘‘)
这里尽管没有删除,但是空字符串会被当成0来执行。会把id为0的删除掉。
解决办法就是当id不存在时不执行此语句。
标签:info 数据 where 产生 class 字段 from set 逻辑
原文地址:https://www.cnblogs.com/aeolian/p/12303951.html