我想要一个查询来根据另外两列的值更新列

时间:2014-08-22 19:36:54

标签: sql sql-server

我一直收到错误。到目前为止我有这个:

update table
set valueA = 'True'
where valueB = 'y' AND valueC = 'n'

2 个答案:

答案 0 :(得分:1)

update x
set valueA = 'True'
from table x
where x.valueB = 'y' AND x.valueC = 'n'

答案 1 :(得分:0)

可能其中一个假设valueA的位数据类型

update table
set valueA = True
where valueB = 'y' AND valueC = 'n'

OR

update table
set valueA = 1
where valueB = 'y' AND valueC = 'n'