SELECT timecontrollings.id,
       areas.id as area,
       areas.nombre as nombreArea,
       timecontrollings.centroCosto,
       centro_costos.nombre as nombreCentroCosto,
       centro_costos.codigo,
       categoria_centro_costos.id as categoria,
       categoria_centro_costos.nombre as nombreCategoriaCentroCosto,
       ROUND(SUM(timecontrollings.horas),2) as horas,
       centro_costos.color,
       MONTH(timecontrollings.fecha) as mes,
       YEAR(timecontrollings.fecha) as year,
       timecontrollings.createdAt,
       timecontrollings.updatedAt
FROM   timecontrollings, centro_costos, areas, usuarios, categoria_centro_costos
WHERE timecontrollings.centroCosto=centro_costos.id AND
        usuarios.area = areas.id AND
        centro_costos.categoria = categoria_centro_costos.id AND
        timecontrollings.usuario = usuarios.id
GROUP BY areas.id,categoria_centro_costos.id, centro_costos.id, MONTH(timecontrollings.fecha), YEAR(timecontrollings.fecha)
