Código:
Utilizo 2 tablas, una de meses(c_c_mes,c_t_mes), la segunda reclamaciones(c_c_empresa,c_c_anho_reclamo, c_c_mes_reclamo, c_c_oficina, c_c_zona, c_c_nro_hoja_reclamo,..... )select '', max( decode( a.c_c_mes,'01' , 1)) col_1, max( decode( a.c_c_mes,'02' , 2)) col_2, max( decode( a.c_c_mes,'03' , 3)) col_3, max( decode( a.c_c_mes,'04' , 4)) col_4, max( decode( a.c_c_mes,'05' , 5)) col_5, max( decode( a.c_c_mes,'06' , 6)) col_6, max( decode( a.c_c_mes,'07' , 7)) col_7, max( decode( a.c_c_mes,'08' , 8)) col_8, max( decode( a.c_c_mes,'09' , 9)) col_9, max( decode( a.c_c_mes,'10' , 10)) col_10, max( decode( a.c_c_mes,'11' , 11)) col_11, max( decode( a.c_c_mes,'12' , 12)) col_12 from sigarp.meses a Union all Select b.c_c_oficina, sum( decode( b.c_c_mes_reclamo,'01', count(1), 0)) cant_col_1, sum( decode( b.c_c_mes_reclamo,'02', count(1), 0)) cant_col_2, sum( decode( b.c_c_mes_reclamo,'03', count(1), 0)) cant_col_3, sum( decode( b.c_c_mes_reclamo,'04', count(1), 0)) cant_col_4, sum( decode( b.c_c_mes_reclamo,'05', count(1), 0)) cant_col_5, sum( decode( b.c_c_mes_reclamo,'06', count(1), 0)) cant_col_6, sum( decode( b.c_c_mes_reclamo,'07', count(1), 0)) cant_col_7, sum( decode( b.c_c_mes_reclamo,'08', count(1), 0)) cant_col_8, sum( decode( b.c_c_mes_reclamo,'09', count(1), 0)) cant_col_9, sum( decode( b.c_c_mes_reclamo,'10', count(1), 0)) cant_col_10, sum( decode( b.c_c_mes_reclamo,'11', count(1), 0)) cant_col_11, sum( decode( b.c_c_mes_reclamo,'12', count(1), 0)) cant_col_12 From sigarp.reclamaciones b Group by b.c_c_oficina;
Me sale el siguiente error: ORA-00937: not a single-group group function. Les quedare muy agradecido por su ayuda. Saludos cordiales.