select nvl(name,name1) as name,sum(num1) as num1,sum(num2) as num2 from
(
select NULL as name,'李四' as name1,null as num1,20 as num2 from dual
union all
select NULL,'李五',null as num1,30 as num2 from dual
union all
select '李四',null,60 as num1,null as num2 from dual
union all
select '李五',null,30 as num1,null as num2 from dual
union all
select '张三','张三',10 as num1,10 as num2 from dual
)
GROUP BY nvl(name,name1)