select a.id,a.name,isnull(a.count,0)+isnull(b.count,0) as count from a left outer join b on a.id=b.id