我坚持以下
我想将小时列中的值用作实际字符串
知道怎么做吗?
Name|Team|Area|Count|Hour
Bob |J1 |UK |1 | 8
Jim |J1 |UK |1 | 9
Tim |J1 |UK |1 | 9
Tom |J1 |UK |1 | 10
答案 0 :(得分:1)
根据预期的行更改此查询。
SELECT *
FROM
( SELECT Name,Team,Area,Count,Hour FROM Tb_Name
)
PIVOT
(COUNT(Name) FOR Hour IN ([8],[9],[10])) P