Well you didn't answer any of my questions and you didn't post DDL/DML. But I'll give an example of PIVOT which may work for you assuming you have 2005 or later. Note that I added an ID column to associate V1 and V2 data into Rows. If you can't figure it out from this then go back to my previous post, answer the questions, and provide your full DDL, DML, and expected results.;with yourTable (id, col1, col2) as( select 1,'V1', 0 union all select 2,'V1', -62.681072235107422 union all select 1,'V2', 0 union all select 2,'V2', -68.894050598144531 union all select 3,'V1', 0 union all select 4,'V1', -60.157051086425781 union all select 3,'V2', 0 union all select 4,'V2', -64.816787719726562 union all select 5,'V1', 0 union all select 6,'V1', -63.651851654052734)select id ,p.v1 ,p.v2from(select id ,col1 ,col2from yourTable) dpivot ( max(col2) for col1 in ([v1],[v2])) pOUTPUT:id v1 v2----------- --------------------------------------- ---------------------------------------1 0.000000000000000 0.0000000000000002 -62.681072235107422 -68.8940505981445313 0.000000000000000 0.0000000000000004 -60.157051086425781 -64.8167877197265625 0.000000000000000 NULL6 -63.651851654052734 NULL
Be One with the OptimizerTG