如何在SQL語句select中根据某个字段值,修改另外一个字段的值

2025-05-01 08:09:36
推荐回答(1个)
回答1:

update table set col2=case when col1 条件1 then 值1 when col1 条件2 then 值2;
或者分为几句修改
update table set col2=值1 where col1 条件1
update table set col2=值2 where col1 条件2