SELECT [MONTH], [2008], [2009], [2010]
FROM
(SELECT Month(Device.FirstAuditDate) [MONTH], Year(Device.FirstAuditDate) [Year], ERPEquipID
FROM Device INNER JOIN Account ON Device.AccountID = Account.AccountID
WHERE Device.ERPEquipID Is Not Null And (Device.ERPEquipID) Not Like ' ') st
PIVOT
(
COUNT(st.ERPEquipID)
FOR [Year] IN ([[2008], [2009], [2010])
) AS pvt
|