How can I create a dynamic pivot table, the dynamic parameter is date in a month ( for example month = January, the pivot value date is from 1 until 31)
I only could make a non-dynamic query like this:
SELECT
*
FROM
(
SELECT
CollectorName,
CountTask,
dayTask,
monthTask
FROM
#tempHistLoad
) DATA
PIVOT
(
SUM(DATA.CountTask)
FOR
dayTask
IN
(
[1],[2],[3],[4],[5]
)
) PVT
how can I make a dynamic column (date from 1 to end of month) in pivot table?