scriptscribe
MIS
I'm running a query to return a field "LOS" that I then want to run an aggregate Sum() function on. The problem is, I've used isnull() on both the initial query and then on the sum query and it's still coming up null.
Suggestions?
I need it to return a 0, as I have another query that totals the sums of several queries (including this one) and it's making the total of that query result in a null.
Suggestions?
Code:
DROP TABLE #DishDays
SELECT c.AcctNum, isnull(DateDiff(d,AdmitDate,DischargeDate),0)AS LOS
INTO #DishDays
FROM #DishDaysKMPBO c
WHERE StartDate<=AdmitDate
AND DischargeDate<=EndDate
Code:
select sum(isnull(Los,0)) as SumLos
from #DishDays
I need it to return a 0, as I have another query that totals the sums of several queries (including this one) and it's making the total of that query result in a null.