将行转换为列?

时间:2016-06-02 14:04:25

标签: sql sql-server

我有一张表,其中包含患者信息和一些值。患者标识符可以在表格中重复,即每个患者ID可以有多个记录。表格示例:

* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

我需要将上述值从行转换为列。它应该如下所示:

ID  Result
1   Positive
1   Negative
2   NULL
2   Negative
2   In-conclusive
3   Negative 
3   Positive
3   
4   Positive
2   Positive

Pivot使用聚合函数来完成任务。但我想使用没有聚合功能的PIVOT。这可能吗?

你能告诉我怎么做吗?

TIA, 斯

0 个答案:

没有答案