您好,欢迎来到刀刀网。
搜索
您的当前位置:首页MySQL的Update语句Set顺序问题_MySQL

MySQL的Update语句Set顺序问题_MySQL

来源:刀刀网
 bitsCN.com 1. 测试一create table test(id int, tag int, num int);
insert into test (id, tag, num) values(1, 1, 1), (2,2, 2), (3,3,3);
update test set tag = 4, num=case when tag=4 then 4 else 3 endwhere tag=3;
select * from test;
(1)sqlserver2014的结果:

(2)MySQL的结果:


2. 测试二:更换set语句的顺序create table test(id int, tag int, num int);

insert into test (id, tag, num) values(1, 1, 1), (2,2, 2), (3,3,3);
update test set num=case when tag=4 then 4 else 3 end, tag = 4<

Copyright © 2019- gamedaodao.com 版权所有 湘ICP备2022005869号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务