【发布时间】:2016-08-07 15:48:31
【问题描述】:
我有一张桌子测试
TestNumber (int primary key)
InactiveBitwise (int)
我发出以下命令:
UPDATE tests SET CASE
WHEN TestNumber = 2 THEN InactiveBitwise = (InactiveBitwise | 4)
WHEN TestNumber = 3 THEN InactiveBitwise = (InactiveBitwise | 8)
END WHERE TestNumber IN (2, 3)
但它给出了错误
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CASE WHEN TestNumber = 2 THEN InactiveBitwise = (InactiveBitwise |'
TestNumber = 2 和 3 都存在,因为我之前通过调用数据库获得了它们。
有人知道它不喜欢什么吗?
【问题讨论】:
标签: mysql sql-update case-when