In this query, day is a date field, effort a numerical field where I keep the number of hours worked and technical, as the name of the technician. I want to get the hours for each month from each technician.
select * from
(
select to_char(dia, 'yyyymm'), tecnico, esfuerzo
from seguimiento_diario
)
pivot
(
sum(esfuerzo) for to_char(dia, 'yyyymm') in (select to_char(dia, 'yyyymm') from seguimiento_diario)
)
order by tecnico