您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

MySQL的Update语句Set顺序问题_MySQL

2024/11/7 12:36:33发布31次查看
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
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product