select a.c1,a.c2,a.c3+b.c3 from
(select c1,c2,sum(c3) c3 from tb a a.c1>a.c2 where exists(select 1 from tb c1=a.c2 and c2 = a.c1) group by c1,c2) a ,
(select c1,c2,sum(c3) c3 from tb a a.c1<a.c2 where exists(select 1 from tb c1=a.c2 and c2 = a.c1) group by c1,c2) b ,
where a.c1 = b.c2 and a.c2 = b.c1
union
select c1,c2,c3 from tb a where not exists(select 1 from tb c1=a.c2 and c2 = a.c1)