Select first.ACType, first.A, (x.Bhr + x.Bmin/60) || ':' || printf("%02d", x.Bmin % 60) as B, (x.Chr + x.Cmin/60) || ':' || printf("%02d", x.Cmin % 60) as C, first.Ahr, first.Amin, x.Bhr, x.Bmin, x.Chr, x.Cmin
from first
left join
(select ACType, sum(Bhr) As Bhr, sum(Bmin)As Bmin, sum(Chr) As Chr, Sum(Cmin) As Cmin
from (select ACType , Bhr, Bmin, Chr, Cmin
from first
union all
select ACType , Bhr, Bmin, Chr, Cmin
from second)
group by ACType) As x Where first.ACType = x.ACType