SQL how to do a pivot of one column regardless of the data -
I basically need to change more than one line in a line
So the basic form Follow me with the result and I want to convert it to but the data is not [1], [2], [3] You can use ROW_NUMBER () for the number of rows, and they can be used to manually convert the fields into fields; . myId apple beer tiger
apple Bear |
Tiger but how can I do this with a pivot, to find out what the outcome of the data is going to be? I tried
SELECT * (myTable from SELECT TOP (3) myTable) src PIVOT (myId) myId IN ([1], [2], [3]) PIIT ;
with cte as (SELECT myId, ROW_NUMBER) ORDER BY MYId) from RAM mytable) Select MAX (case when RN = 1 then my IDEnd) field 1, max (case when RN = 2 Then my IDEnd) field 2, max (in case RN = 3 then mineind) field 3 whistle;
Comments
Post a Comment