日期:2014-05-18 浏览次数:20490 次
declare @表A table (ID int,A1 varchar(2)) insert into @表A select 1,'a1' union all select 2,'a2' union all select 3,'a3' declare @表B table (ID int,B1 varchar(2)) insert into @表B select 3,'b3' union all select 4,'b4' union all select 5,'b5' select isnull(a.ID,b.ID) as ID,a.A1,b.B1 from @表A a full join @表B b on a.ID=b.ID /* ID A1 B1 ----------- ---- ---- 1 a1 NULL 2 a2 NULL 3 a3 b3 4 NULL b4 5 NULL b5 */