已解决:基本错误,没有逗号分隔SET值列表
我试图在MySql的UPDATE / SET中包含一个条件语句。我尝试过三种不同的尝试(全部用完)。我做错了什么?
$stmt = $db->prepare(
"UPDATE mytable1 tb1, mytable2 tb2 "
. "SET "
. "tb1.Value1 = (tb1.Value1 + :Value1Diff) "
//. "IF tb1.Slot >= 0 THEN tb2.ValueBitwise=(tb2.ValueBitwise | (1 << tb1.Slot)); END IF; "
//. "tb2.ValueBitwise= CASE WHEN tb1.Slot >= 0 THEN (tb2.ValueBitwise | (1 << tb1.Slot)) ELSE tb2.ValueBitwise END "
. "tb2.ValueBitwise=IF(tb1.Slot >= 0, tb2.ValueBitwise | (1 << tb1.Slot), tb2.ValueBitwise) "
. "tb1.Value2 = :Value2 "
. "WHERE "
. "tb1.Property1=tb2.Property2");
$stmt->execute(array(':Value1Diff' => $Value1Diff, ':Value2 ' => $Value2));