81,091
社区成员
发帖
与我相关
我的任务
分享
use test
create table table1
(
id int primary key AUTO_INCREMENT,
tValue nvarchar(15) not null
);
insert into table1(tValue) values('w322');
create table table2
(
id int primary key AUTO_INCREMENT,
tValue nvarchar(15) not null
);
insert into table2(tValue) values('55');
select * from table1;
select * from table2;
--更新
UPDATE table1
SET tValue=t2.tValue
from table1
inner join (select table2.id,table2.tValue
from table2) t2
on table1.id = t2.id
select *
from table1
inner join (select table2.id,table2.tValue
from table2) t2
on table1.id = t2.id