日期:2014-05-18 浏览次数:20603 次
declare @tb1 table (id0 int,name varchar(20))
insert into @tb1
select 0,'liu' union all
select 1,'wang'
declare @tb2 table(id1 int ,other varchar(20))
insert into @tb2
select 0,'beijing'
select a.*,b.other from @tb1 as a left join @tb2 b on a.id0=b.id1
/*
id0 name other
----------- -------------------- --------------------
0 liu beijing
1 wang NULL
(2 行受影响)
*/