通过子查询批量更新某列字段等于有1的数据
SELECT
KanChaID
FROM st_ExamineInform WHERE ProjectID=80
判断当 KanChaID > 0 时 将 KanChaID 的值设置为1 语句应该怎么写
update ExamineInform set KanCharId=1 where KanChaId
in (select KanChaId from ExamineInform where ProjectID=80 and KanChaID > 0)
无聊的写法:
update st_ExamineInform set KanChaID=1 where KanChaID in (select KanChaID from (SELECT
KanChaID
FROM st_ExamineInform WHERE ProjectID=80) b where KanChaID>0)