select 单位编码,单位名称, sum(count) from( form (select 上级单位编码 as 单位编码,单位名称, sum(count) as count  from table where  上级单位编码='10000000' group by 单位编码,单位名称, 上级单位编码) union all (select 上级单位编码 as 单位编码,单位名称, count from table where  单位编码='10000000') tempTable) group  by 单位编码,单位名称