Ver Mensaje Individual
  #7 (permalink)  
Antiguo 14/06/2011, 16:13
Avatar de informacionsys
informacionsys
 
Fecha de Ingreso: mayo-2011
Ubicación: Bogota D.C
Mensajes: 793
Antigüedad: 13 años
Puntos: 76
Respuesta: Convertir varias filas en una solo registro.

Hola..

Le agregue el group by de la siguiente manera:


SELECT cod_suc,tip_recep, [001] AS INDIRECTO ,[002] AS DIRECTO ,[003] AS CORPORATIVO
FROM
(SELECT cod_suc ,tip_recep, cat_dis , semana
FROM temporalGerente) AS temporal
PIVOT
(
COUNT(semana)
FOR cat_dis IN ([001],[002],[003])
) AS pivotTable
GROUP BY cod_suc , tip_recep , cat_dis , 001 , 002 , 003


Pero me arroja el siguiente error:


Todas las expresiones GROUP BY deben contener al menos una columna que no sea una referencia exterior.
...


Gracias