select b.*,a.* from from t1,t2 where t1.AuthorizedCode=t2.AuthorizedCode
insert into 表2(TrocheType,Standard) select TrocheType,Standard from 表1 where AuthorizedCode...
insert into 表2(TrocheType,Standard) select TrocheType,Standard from 表1 where ....后面加你需要的条件
update 表2 set TrocheType=b.TrocheType, Standard=b.Standard from 表1 b,表2 a where a.AuthorizedCode=b.AuthorizedCode ??
update t2 set t2.TrocheType=t1.TrocheType, t2.Standard=t1.Standard from t1,t2 where t2.AuthorizedCode=t1.AuthorizedCode ?
update 表2 set TrocheType=b.TrocheType,Standard=B.Standard from 表2 a,表1 b where a.AuthorizedCode=b.AuthorizedCode
update 表2 set 表2.TrocheType = 表1.TrocheType,表2.Standard = 表1.Standard from 表1 where 表2.AuthorizedCode = 表1.AuthorizedCode是这个意思吗?
create table 表1(AuthorizedCode int,TrocheType int,[Standard] int) insert into 表1 select 1,58,399 insert into 表1 select 2,348,48 create table 表2(AuthorizedCode int,TrocheType int,[Standard] int,colother int) insert into 表2 select 1,33,385,66 insert into 表2 select 2,858,85,77 go update 表2 set trochetype=b.trochetype,standard=b.standard from 表2 a inner join 表1 b on a.authorizedcode=b.authorizedcode go select * from 表2 go drop table 表1,表2 /* AuthorizedCode TrocheType Standard colother -------------- ----------- ----------- ----------- 1 58 399 66 2 348 48 77 */
1:update 表2 set 表2.TrocheType = 表1.TrocheType,表2.Standard = 表1.Standard from 表1 where 表2.AuthorizedCode = 表1.AuthorizedCode 2:update t2 set TrocheType =(select TrocheType from 表2 where AuthorizedCode=t2.AuthorizedCode), Standard =(select Standard from 表2 where AuthorizedCode=t2.AuthorizedCode) from 表2 t2
from t1,t2 where t1.AuthorizedCode=t2.AuthorizedCode
update 表2
set TrocheType=b.TrocheType,
Standard=b.Standard
from 表1 b,表2 a
where a.AuthorizedCode=b.AuthorizedCode
??
t2
set
t2.TrocheType=t1.TrocheType,
t2.Standard=t1.Standard
from
t1,t2
where
t2.AuthorizedCode=t1.AuthorizedCode
?
where a.AuthorizedCode=b.AuthorizedCode
set 表2.TrocheType = 表1.TrocheType,表2.Standard = 表1.Standard
from 表1
where 表2.AuthorizedCode = 表1.AuthorizedCode是这个意思吗?
insert into 表1 select 1,58,399
insert into 表1 select 2,348,48
create table 表2(AuthorizedCode int,TrocheType int,[Standard] int,colother int)
insert into 表2 select 1,33,385,66
insert into 表2 select 2,858,85,77
go
update 表2 set trochetype=b.trochetype,standard=b.standard from 表2 a inner join 表1 b on a.authorizedcode=b.authorizedcode
go
select * from 表2
go
drop table 表1,表2
/*
AuthorizedCode TrocheType Standard colother
-------------- ----------- ----------- -----------
1 58 399 66
2 348 48 77
*/
set 表2.TrocheType = 表1.TrocheType,表2.Standard = 表1.Standard
from 表1
where 表2.AuthorizedCode = 表1.AuthorizedCode 2:update t2
set TrocheType =(select TrocheType from 表2 where AuthorizedCode=t2.AuthorizedCode),
Standard =(select Standard from 表2 where AuthorizedCode=t2.AuthorizedCode)
from 表2 t2