Reputation: 89
Im stuck with the following
I want to use the values from the hours column as actual colums
Any idea how to do this?
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
Upvotes: 0
Views: 39
Reputation: 465
Change this query based on your expected rows.
SELECT *
FROM
( SELECT Name,Team,Area,Count,Hour FROM Tb_Name
)
PIVOT
(COUNT(Name) FOR Hour IN ([8],[9],[10])) P
Upvotes: 1