If you access a column from the table to be updated in an expression, 如果访问要在表达式中更新的表中的列,UPDATE
uses the current value of the column. UPDATE
将使用该列的当前值。The second assignment in the following statement sets 下面语句中的第二个赋值将col2
to the current (updated) col1
value, not the original col1
value. col2
设置为当前(更新的)col1
值,而不是原始的col1
值。The result is that 结果是col1
and col2
have the same value. This behavior differs from standard SQL.col1
和col2
具有相同的值。此行为与标准SQL不同。
UPDATE t1 SET col1 = col1 + 1, col2 = col1;