select c,'' as b,sum(a) as a from tb where c is not null group by c
union all
select * from tb where c is null是不是这个意思?