UPDATE test_table
SET
A = IF( A >= B, A - B, A),
C = IF( A >= B, C + 1, C)
WHERE D = 1
The second assignment in the following statement sets col2 to the current (updated) col1 value, not the original col1 value. The result is that col1 and col2 have the same value. This behavior differs from standard SQL.UPDATE t1 SET col1 = col1 + 1, col2 = col1;