PIVOT columns and replace null values with 0
|
CodeGenerated |
1 |
select
Department
, [2017-07-07 18:17:25] = isnull([2017-07-07 18:17:25],0)
, [2017-07-08 18:17:25] = isnull([2017-07-08 18:17:25],0)
, [2017-07-09 18:17:25] = isnull([2017-07-09 18:17:25],0)
from (select * from #Daysoftheweek) x
pivot (avg(TotalUtilized)for DayoftheWeek in ([2017-07-07 18:17:25], [2017-07-08 18:17:25], [2017-07-09 18:17:25])) p |
|
Department |
2017-07-07 18:17:25 |
2017-07-08 18:17:25 |
2017-07-09 18:17:25 |
1 |
cicu |
0 |
0 |
0 |
2 |
er |
0 |
0 |
0 |
3 |
icu |
0 |
1 |
1 |
|
λ
.NET NoSQL database for rapid development
|