DROP TABLE #Pivot
CREATE TABLE #Pivot
(
descripcion VARCHAR(100),
idtipomonto INT,
monto int
)
INSERT INTO #Pivot
(
descripcion,
idtipomonto,
monto
)
VALUES ( 'esteban', 10, 100 )
INSERT INTO #Pivot
(
descripcion,
idtipomonto,
monto
)
VALUES ( 'isabel', 20, 200 )
INSERT INTO #Pivot
(
descripcion,
idtipomonto,
monto
)
VALUES ( 'cristina', 30, 300 )
SELECT *
FROM #Pivot
SELECT *
FROM #Pivot PIVOT ( SUM(monto) FOR idtipomonto IN ( [10], [40] ) ) AS pvt
Monday, November 17, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment