修改table表中的flag字段,让id = ‘123’的一条记录flag = '1', 其他的记录全设置为flag = '0'。sql大概的意思是这样的 update table set flag = '1' where id = '123' , set flag = '0' where id <> ‘123’ ;这个语句不好使,就想一条sql能实现这个功能
3条回答 默认 最新
Kyle_Ping 2022-01-04 17:47关注可以用
case。如:update table set flag = case when id = '123' then '1' else '0' end本回答被题主选为最佳回答 , 对您是否有帮助呢?评论 打赏 举报解决 1无用