mysql multiple-talbe update

mysql multiple-talbe update

create table a ( no int not null, value varchar(30));
create table b ( no int not null, value varchar(30));
insert into a(no, value) values(1, 'a1');
insert into a(no, value) values(2, 'a2');
insert into a(no, value) values(3, 'a3');
insert into b(no, value) values(1, 'b1');
insert into b(no, value) values(2, 'b2');

update a, b set a.value = b.value where a.no = b.no;

你可能感兴趣的:(mysql multiple-talbe update)