Pivots in SQL Server are new to me and have been struggling to come up with the result in the following image. The departments are random. I was looking at a unknown column name pivot query but I can't figure it out. The table will have thousands of rows and a max of 50 departments. Any help would be much appreciated.
This is what I am trying:
select department, employees, pct, up_down
from
(
select employees, department
from etl_insight_counts
) d
pivot
(
max(employees)
for department in (department, employees, pct, up_down)
) piv;