1. Test 1Create table test (id int, tag int, num int );
Insert into test (id, tag, num) values (1, 1, 1), (2, 2), (3, 3 );
Update test setTag = 4, num = case when tag = 4 then 4 else 3 endWhere tag = 3;
Select * from test;
(1) sqlserver2014 results:
(2) MySQL results:
2. Test 2: sequence of changing the set statementCreate table test (id int, tag int, num int );
Insert into test (id, tag, num) values (1, 1, 1), (2, 2), (3, 3 );
Update test setNum = case when tag = 4 then 4 else 3 end, tag = 4 <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> Upper + lower "http://www.2cto.com/uploadfile/Collfiles/20140327/2014032709015710.jpg" alt = "\">
(2) MySQL results
Conclusion:
(1) In the MySQL update statement, the sequence of the set columns is related. The calculation of the following columns is based on the results of the preceding columns, that is, evaluation from left to right;
(2) in SQL Server's update statement, the set sequence is irrelevant, and all changes are based on the snapshots taken previously;