我在转换一个看起来像这样的表
时遇到了问题PropertyName | PropertyValue
---------------------------------
color red
color blue
size big
size small
进入这个:
Color | Size
---------------------------------
red big
red small
blue big
blue small
我怎样才能做到这一点?提前感谢您的帮助。
答案 0 :(得分:1)
您想要每种颜色和尺寸的排列吗?
SELECT color, size FROM
(
select distinct PropertyValue AS color
from YourTable
where PropertyName = 'color'
) T1
CROSS JOIN
(
select distinct PropertyValue AS size
from YourTable
where PropertyName = 'size'
) T2