select 公司名称,sum(人员数量) 人员数量,0 as 要求数量
from 表
group by 公司名称
union all
select 公司名称,0 as 人员数量,sum(需求数量) 需求数量
select 公司名称,sum(人员数量) as 人员数量,sum(要求数量) as 要求数量 from ( select 公司名称,人员数量,0 as 要求数量 from 表1 union all select 公司名称,0 as 人员数量,要求数量 from 表2 ) t group by 公司名称
用full join
union all不行吗,然后再distinct
full join
没有full join 的话只能先left join 然后 right join了