• You have changed some datetime values compared to your initial post/sample. If you alter the filters to include the (startdate and) enddate, both solutions will give the correct results

    --Answer 1

    SELECT SUM(Boiler1) AS [OUTSIDE THE DATES 2]

    FROM @Energy_Centre_Availability ECA

    LEFT OUTER JOIN @Energy_Centre_Boiler_Maintenance_Schedule ECBMS

    ON ECA.t_stamp >= ECBMS.StartDate

    AND ECA.t_stamp <= ECBMS.EndDate

    WHERE ECBMS.ndx IS NULL

    --Answer 2

    SELECT SUM(Boiler1) AS [OUTSIDE THE DATES 3]

    FROM @Energy_Centre_Availability eca

    WHERE NOT EXISTS (

    SELECT 1

    FROM @Energy_Centre_Boiler_Maintenance_Schedule s

    WHERE eca.t_stamp >= s.startDate AND eca.t_stamp <= s.endDate

    )

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **