I'm attempting the pivot below:
SELECT EmpID as ID,  as January,  as February,  as March,  as April,  as May,  as June,  as July,  as August,  as September,  as October,  as November,  as December, isnull((processeddate),' ') as 'Null' FROM ( SELECT EmpID, EmpDeductAmt, month(ProcessedDate) as TMonth FROM [dbo].[Invoices] where Inv_Number not in ('1035','1039') ) AS source PIVOT ( sum(EmpDeductAmt) for TMonth in (, , , , , , , , , , , ) ) AS pvtmonth ORDER BY EmpID;
However, I receive an error message of "Invalid column name 'processeddate' upon hitting F5.
I'm fairly green, but the code worked beautifully when the isnull((processed date),' ') as 'Null' code was left off.
The desired output would consist of columns pertaining to each month in addition to a column for NULL months, as some of the records in my dataset have NULL as their date. Failure to account for the NULL dates shortchanges the dollar amount arrived out. The rows are arranged by employee identification number.
Is there a suggested remedy for this issue?
Many, many thanks!