我有一個表TEST
,列VALUE,VALUE_SIM,SIM_STATUS,ID
。我想爲ID = 288
更新SIM_STATUS
列。我也想在更新後顯示這些列。通過比較同一表中的兩個不同列來更新列
的條件是:
1. SIM_STATUS = 0 when VALUE = VALUE_SIM.
2. SIM_STATUS = 1 when VALUE < VALUE_SIM.
3. SIM_STATUS = 2 when VALUE > VALUE_SIM.
我寫了下面的查詢,但它顯示一個錯誤。要
("UPDATE TEST"
"SET SIM_STATE = (CASE WHEN VALUE = VALUE_SIM THEN SIM_STATE = 0 END)"
"SET SIM_STATE = (CASE WHEN VALUE < VALUE_SIM THEN SIM_STATE = 1 END)"
"SET SIM_STATE = (CASE WHEN VALUE > VALUE_SIM THEN SIM_STATE = 2 END)"
"where ID = 288 ");
和錯誤是什麼? –
錯誤:QODBCResult :: exec:無法執行語句:「[Microsoft] [SQL本機客戶端] [SQL Server] Falsche語法in'='。'[Microsoft] [SQL Native Client] [SQL Server] Anweisung en)konnte(n)nicht vorbereitet werden。「 –