Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
gnaus
Starting Member
41 Posts |
Posted - 2011-11-30 : 05:15:27
|
Dear reader,I have this table. I want to make colums from the rows.Al “Opmerkingen” with the same “ClientnrQzorg” on ONE row, so multiple colums “Opmerkingen” (in stead of now, multiple rows per “ClientnrQzorg”).ClientnrQzorg Opmerkingen BesluitnummerCL010001 5-3-08 aanvraag binnen bij t informatie.. 5CL010001 23-4-08 indicatie binnen op t AZR, VP.. 106CL010001 25-2-09 indicatie binnen op t.. 107CL010001 9-11-09 indicatie binnen op.. 108CL010002 26-9-07 aanvraag binnen op t AZR.. 1CL010002 19-12-07 indicatie binnen op t AZR.. 102CL010002 16-11-09 indicatie binne op AZR.. 103CL010003 18-3-09 LET OP: Dit blijkt… 1So I want the result to be:ClientnrQzorg Opmerkingen1 Opmerkingen2 Opmerkingen3 Opm4CL010001 5-3-8 aanvr. 23-4-08 indicat.. 25-2-09 indicatie.CL010002 26-09-07 a… 19-12-07 indic.. .. etcCL010003 18-3-09 LET.. But also I want that it’s clear wich “Opmerkingen” belongs to wich “Besluitnummer”!!!Thank you!(ps I found something about Pivot’s etc. on this forum, but I couldn’t translate quite well to my situation) I tried This:select 'Opmerkingen' [1],[2],[3],[4],[5],[6],[7], ,[9],[10],[11]from EigOpmIndicatieEnClientnrQzorgAlleKaartenPIVOT( group by(ClientnrQzorg)FOR [Opmerkingen] IN ( [1], [2],[3],[4], [5],[6],[7], ,[9],[10], [11],[12])) order by ClientnrQzorgerror Msg 156, Level 15, State 1, Line 11Incorrect syntax near the keyword 'group'.GNGN |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|
|