вариант использования, когда
select employee ,period,
sum(case when attribute='basic' then amount else 0 end) basic,
sum(case when attribute='H.Rent' then amount else 0 end H_Rent,
sum(case when attribute='Convene' then amount else 0 end) Convene,
sum(case when attribute='Medical' then amount else 0 end) Medical,
sum(case when attribute='basic' then amount else 0 end)+
sum(case when attribute='H.Rent' then amount else 0 end)+
sum(case when attribute='Convene' then amount else 0 end)+
sum(case when attribute='Medical' then amount else 0 end) as gross
from payroll group by employee ,period