Server: Msg 125, Level 15, State 4, Line 11
Case expressions may only be nested to level 10.
Código SQL:
Ver original
SELECT CASE WHEN mes=12 THEN'Diciembre'ELSE CASE WHEN mes=1 THEN'Enero'ELSE CASE WHEN mes=2 THEN'Febero'ELSE CASE WHEN mes=3 THEN'Marzo'ELSE CASE WHEN mes=4 THEN'Abril'ELSE CASE WHEN mes=5 THEN'Mayo'ELSE CASE WHEN mes=6 THEN'junio'ELSE CASE WHEN mes=7 THEN'julio'ELSE CASE WHEN mes=8 THEN'Agosto'ELSE CASE WHEN mes=9 THEN'Septiembre'ELSE CASE WHEN mes=10 THEN'Octuvre'ELSE CASE WHEN mes=11then'Noviembre' END END END END END END END END END END END END AS mes, SUM (prima_us) AS prima_us_PC,SUM (0) AS prima_us_BU,(0)AS prima_us_PC2,SUM(0) AS prima_us_BU2 FROM produ_comercial WHERE (manager = 'L'AND mes IN ('1','2','3','4','5','6','7','8','10','11','12') AND cia ='000169'AND linea ='Energy'AND YEAR IN (2009) ) GROUP BY mes