I have to rotate a given table from an SQL Server but a normal pivot just doesn\'t work (as far as i tried). So has anybody an idea how to rotate the table into the desired
select
id,
'Numerator' as ValueType,
case when label = labelNameOne then Numerator else 0 end as LabelNameOne,
case when label = labelNameTwo then Numerator else 0 end as LabelNameTwo,
case when label = labelNameTree then Numerator else 0 end as LabelNameTree,
case when label = labelNameFour then Numerator else 0 end as LabelNameFour,
case when label = labelNameFive then Numerator else 0 end as LabelNameFive,
case when label = labelNameSix then Numerator else 0 end as LabelNameSix
union All
... similar query with Denominator ...
union all
... similar query with Ratio...