• This should give you more accurate totals, although it will list every combination of ProductionLine and Category, which may not be what you want.

    SELECT D.Line AS Line, D.ProductionLine AS ProductionLine, D.Shift AS Shift, D.DownTime,

    R.Category, R.AssignedDowntime,

    CONVERT(VARCHAR(10), D.DatePacked,101) AS DatePacked

    FROM (

    SELECT Line, Shift, DatePacked, Category,

    SUM(Cast(R.Downtime AS INT)) AS AssignedDowntime

    FROM Production.DownTimeReason

    WHERE (DatePacked >= '20150127'

    AND DatePacked < '20150128')

    GROUP BY Line, Shift, DatePacked, Category

    ) AS R

    LEFT OUTER JOIN (

    SELECT Line, Shift, DatePacked, ProductionLine,

    SUM(CAST(D.DownTime AS INT)) AS DownTime

    FROM Production.DownTimeHistory

    WHERE (DatePacked >= '20150127'

    AND DatePacked < '20150128'

    AND DownTime != 0

    AND Shift = '1')

    GROUP BY Line, Shift, DatePacked, ProductionLine

    ) AS D

    ON D.Line = R.Line

    AND D.Shift = R.Shift

    AND D.DatePacked = R.DatePacked

    ORDER BY D.Line, D.Shift, D.DatePacked

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.