I have a problem and can't find a way to solve it.
This is my part of my query that I cannot solve.
Select Datepart(day,date) as Day,
Department,SUM(hourly) as workhours
from MIVDb.dbo.evid as p
Inner Join MIVdb.dbo.workers as r
On p.rad=r.rad
Group by Department,
Datepart(day,date)
Nothing special about it. My problem is that I get table looking like
Days Dept Hours
1 Sales 8
2 Cust 10
And i need:
Dept 1 2 ....etc
Sales 8 10 ....etc
So I need days to be columns. Problem is that Days column is dynamic, it can have on day, of 20 day, it can be week or even month. Can someone point help me with this.