January 25, 2011 at 10:26 am
Hello,
I have a DATEDIFF function in my query that returns NULL values.
How can I modify this query so that I can get zeroes instead of Nulls?
The part of the query in BOLD is in question.
SELECTSector, Region, employee_num_tech AS [Technician #],
SUM (DATEDIFF(mi,wow_start,wow_end)) AS [TOTAL MINS], DATEPART(yyyy, date_identified) AS YEAR, DATENAME(mm,date_identified) AS MONTH
FROM TABLE 1
Thanks
January 25, 2011 at 10:31 am
This will do it:
SELECT Sector, Region, employee_num_tech AS [Technician #],
ISNULL ( SUM (DATEDIFF(mi,wow_start,wow_end)) ,0) AS [TOTAL MINS], DATEPART(yyyy, date_identified) AS YEAR, DATENAME(mm,date_identified) AS MONTH
FROM TABLE 1
I have used the ISNULL function to wrap the "bold" text..
January 25, 2011 at 10:48 am
Thank you so much, I was also trying the ISNULL function, but couldn't get it in the right spot!
January 25, 2011 at 10:51 am
You are welcome 🙂
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply