答案 0 :(得分:0)
您没有提供详细信息,因此我将建议以下解决方案进行透视:
with cte as(select col1,
col2,
col3,
row_number() over(partition by col1, col2 order by col3) rn
from tablename)
select col1, col2, [1] as col3, [2] as col4
from cte
pivot(max(col3) for rn in([1],[2]))p