• Yes! That is exactly what I have spent the last week trying to achieve.

    Thanks so much.

    Could I just asked if I wanted the opposite of the results would the only way be this:

    SELECT

    (select sum(Boiler1)

    from @Energy_Centre_Availability ECA)

    -

    (select sum(Boiler1)

    from @Energy_Centre_Availability ECA

    inner join @Energy_Centre_Boiler_Maintenance_Schedule ECBMS

    on ECA.t_stamp >= ECBMS.StartDate

    and ECA.t_stamp <= ECBMS.EndDate)

    Thanks again.