日期:2014-05-17 浏览次数:20439 次
create table #t1(a varchar(5), b varchar(5),c varchar(5))
insert into #t1 select '11', '21',null union all select '12', '22',null union all select '13','23',null
create table #t2(a varchar(5), c varchar(5))
insert into #t2 select '11', '31'
union all select '12', '32'
union all select '13', '33'
select * from #t1
select * from #t2
UPDATE #t1
SET #t1.c=#t2.c
FROM #t1 INNER JOIN #t2 ON #t1.a=#t2.a
select * from #t1
select * from #t2
drop table #t1
drop table #t2