In that case you could do it with PIVOT:with yourTable (DateStamp , Reading , Channel) as (select '01-06-2012' , 1.0 , 111 union allselect '01-06-2012' , 2.0 , 111 union allselect '01-06-2012' , 3.0 , 222 union allselect '01-06-2012' , 4.0 , 222 )select dateStamp ,[111] ,[222]from ( select DateStamp ,Reading ,Channel ,row_number() over (partition by channel order by reading) rn from yourTable ) dpivot (max(Reading) for channel in ([111],[222])) pOUTPUT:dateStamp 111 222---------- --------------------------------------- ---------------------------------------01-06-2012 1.0 3.001-06-2012 2.0 4.0
Be One with the OptimizerTG