主题:[原创]MySQL 元组update失败, 寻求解决方案
create table t1 ( a int primary key, b int not null );
create table t2 ( a int primary key, b int not null );
insert into t1 values (1,1);
insert into t1 values (2,2);
insert into t1 values (3,3);
insert into t2 values (1,-3);
insert into t2 values (2,-13);
update t2 set (a,b) = (select a,b from t1 where t1.a = t2.a); ## 失败!
create table t2 ( a int primary key, b int not null );
insert into t1 values (1,1);
insert into t1 values (2,2);
insert into t1 values (3,3);
insert into t2 values (1,-3);
insert into t2 values (2,-13);
update t2 set (a,b) = (select a,b from t1 where t1.a = t2.a); ## 失败!