a impossible mission?
两个表
table m
name(varchar(50)) size(varchar(50))
a 1
b 2
c 3
table n:
id(int) number(int)
table n是空的
result:
name size id number
a 1 0 0
b 2 0 0
c 3 0 0
怎么得到这个result
------解决方案-------------------- create table #m (name varchar(50), size varchar(50))
create table #n (id int, number int)
insert into #m select 'a ', 1
insert into #m select 'b ', 2
insert into #m select 'c ', 3
select a.*,isnull(b.id,0) as id,isnull(b.number,0) as number
from #m as a left join #n as b on 1=1
drop table #m,#n