Setting values from a Pivot to 0?
-
How do I set value to zero in a Pivot? I would like to set the NULL values to zero from attached code
Select * From
(select Partner, Facility, PAY_PERIOD_BEGIN_DATE, PAY_PERIOD_END_DATE, Job_Code, Pay_ClassHrs, Pay_ClassAmount, Pay_Hours, Pay_Amount from #PremierFinal) as sourcetable
PIVOT
(
sum(Pay_Hours)
FOR Pay_ClassHrs in (PBS_Hrs, POT_Hrs, PED_Hrs, POR_Hrs, PJB_Hrs, PTO_Hrs, PWH_Hrs, PHR_Hrs, PNH_Hrs)
)as pvtQuote:
PBS_Hrs NULL NULL NULL NULL 792 278 NULL
-
How do I set value to zero in a Pivot? I would like to set the NULL values to zero from attached code
Select * From
(select Partner, Facility, PAY_PERIOD_BEGIN_DATE, PAY_PERIOD_END_DATE, Job_Code, Pay_ClassHrs, Pay_ClassAmount, Pay_Hours, Pay_Amount from #PremierFinal) as sourcetable
PIVOT
(
sum(Pay_Hours)
FOR Pay_ClassHrs in (PBS_Hrs, POT_Hrs, PED_Hrs, POR_Hrs, PJB_Hrs, PTO_Hrs, PWH_Hrs, PHR_Hrs, PNH_Hrs)
)as pvtQuote:
PBS_Hrs NULL NULL NULL NULL 792 278 NULL
Try using an ISNULL e.g. ISNULL(sum(Pay_hours),0)
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================
-
Try using an ISNULL e.g. ISNULL(sum(Pay_hours),0)
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================
-
Try using an ISNULL e.g. ISNULL(sum(Pay_hours),0)
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================