SQL Server- PIVOT table. transform row into columns
- by Matt
I am trying to convert rows into columns. here is my query
SELECT M.urn,
M.eventdate,
M.eventlocation,
M.eventroom,
M.eventbed,
N.time
FROM admpatevents M
INNER JOIN admpattransferindex N
ON M.urn = N.urn
AND M.eventseqno = N.eventseqno
AND M.eventdate = N.eventdate
WHERE M.urn = 'F1002754364'
AND M.eventcode = 'TFRADMIN'
Current result
URN Date Location Room Bed Time
F1002754364 20121101 EDEXPRESS 4-152 02 0724
F1002754364 20121101 CARDSURG 3-110 02 1455
F1002754364 20121102 CHEST UNIT 6-129-GL04 1757
required result
F1002754364 20121101 EDEXPRESS 4-152 02 0724 20121101 CARDSURG 3-110 02 1455 20121102 CHEST UNIT 6-129-GL 04 1757
Thanks for your help.