select isnull(a.name,b.name) as [name],
       fcount,
       Lcount
from table1 a full join table2 b on a.name=b.name

解决方案 »

  1.   

    select Name ,fount ,Lcount = 0 
    Into  #tmp 
    from  table1
    union 
    select Name ,fount=0 ,Lcount 
     from  table2 select Name ,fount=max(isnull(fount,0)),Lcount =Max (isnull(Lcount,0 ))
    from #tmp
      

  2.   

    -----sorry 筆誤select Name ,fount ,Lcount = 0 
    Into  #tmp 
    from  table1
    union 
    select Name ,fount=0 ,Lcount 
     from  table2 select Name ,fount=max(isnull(fount,0)),Lcount =Max (isnull(Lcount,0 ))
    from #tmpgroup by name
      

  3.   

    select a.name,Fcount,Lcount from table1 a right join table2 b on a.name=b.name
    union
    select b.name,Fcount,Lcount from table2 b right join table1 a on a.name=b.name