NULL Values

  • 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

  • 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..

  • Thank you so much, I was also trying the ISNULL function, but couldn't get it in the right spot!

  • 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