Hello, I have a table that lists all the reasons for a line delay. I have a table that may or may not have a line delay for today. I need a query that shows all possible reasons, sum the total line delay even if there were no line delays today. I have everything I need untill I try to put the requirement of today. Then it bombs. Here is the code.
SELECT sum(isnull(ld.LineDelayTimeLost,0)) as SumLD, rc.reasoncodedescription
FROM dbo.tblReasonCode AS RC left outer join
dbo.tblLineDelay AS LD on RC.ReasonCodeID = LD.ReasonCodeID left outer join
dbo.tblCPSEOS AS CPS ON LD.CPSEOSID = CPS.CPSEOSID
group by rc.ReasonCodeDescription
This gives me the following: all the reason codes and there total line delay for all time. If there is no line delay it place a 0 in the correct colum,
when I add Where cps.CPSEOSDate =convert(varchar(10), getdate(),121) I get nothing if nothing has been entered for today. How do I make all the reason codes show up with a 0 in the correct colum?
Thank you in advance!