How to make awkward pivot of sql table in SQL Server 2005?

后端 未结 3 1211
忘掉有多难
忘掉有多难 2021-01-05 08:58

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

3条回答
  •  无人及你
    2021-01-05 09:41

    What you seek is dynamic cross tab. The short answer is that it cannot be done in T-SQL without some fugly dynamic SQL. The Hoyle answer is that you should pivot the data in a reporting tool or in the middle tier.

提交回复
热议问题