热线电话:13121318867

登录
2019-02-28 阅读量: 719
SQL查询语句

问题描述:

一张表中有两个字段 A、B, A的值只可能是0或1。

现在我想给B初始化数据,如果A = 0, 那么B设值为123;如果A = 1, 那么B设值为456.

解决方法:

update table t set t.B =
(case
when t.A = 0 then '123'
when t.A = 1 then '456'
end);
0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子