SQL Server 2005, turn columns into rows

后端 未结 6 943
广开言路
广开言路 2020-12-10 06:50

I am trying to turn a table 90 degrees: make columns rows. No PIVOT is allowed since PIVOT requires aggregate functions.

Example: I have a table with the columns

6条回答
  •  庸人自扰
    2020-12-10 07:16

    I found the solution as the following:

    SELECT 
        ID, DE, EN
    FROM 
        TextTable 
    PIVOT(MAX([text]) FOR ISO IN (DE,EN)) p
    

    It's possible to use PIVOT with MAX aggregating function over the text.

提交回复
热议问题