Pivotear Tabla

07/03/2007 - 23:10 por Aldo Salvado | Informe spam
Sres, junto con saludarles quisiera hacerles la siguiente consulta

tengo la siguiente tabla

LOC_ID LOC_PERS LOC_FECHA LOC_LUGAR
1 JUAN 01-01-2007 OFICINA
2 JUAN 02-01-2007 PLANTA

y quisiera obtener esto

LOC_PERS '01-01-2007' '02-01-2007'
JUAN OFICINA PLANTA

Muchas Gracias,


Saludos.


Aldo.
 

Leer las respuestas

#1 Alejandro Mesa
07/03/2007 - 22:22 | Informe spam
Aldo,

Que version de SQL Server estas usando?

How to rotate a table in SQL Server
http://support.microsoft.com/defaul...roduct=sql

Using PIVOT and UNPIVOT
msdn2.microsoft.com/en-us/library/ms177410.aspx

Busca en este mismo grupo por la palabra "pivot" y podras leer algunos
ejemplos.


AMB


"Aldo Salvado" wrote:

Sres, junto con saludarles quisiera hacerles la siguiente consulta

tengo la siguiente tabla

LOC_ID LOC_PERS LOC_FECHA LOC_LUGAR
1 JUAN 01-01-2007 OFICINA
2 JUAN 02-01-2007 PLANTA

y quisiera obtener esto

LOC_PERS '01-01-2007' '02-01-2007'
JUAN OFICINA PLANTA

Muchas Gracias,


Saludos.


Aldo.



Preguntas similares