select data between 2 dates in SQL
I have a problem with the following code: SELECT PM.PM_Eng_Name,
ISNULL(SUM(PMOutput.Quantity),0) AS TotalOut FROM PM LEFT OUTER JOIN
PMOutput ON PM.PM_code = PMOutput.PM_code WHERE (PMOutput.Output_Date
BETWEEN '2013-01-01' AND '2013-08-25') GROUP BY PM.PM_Eng_Name
When I run this query I got the total output only for the materials that
have output transactions during the selected date rang, while I need to
generate the total output for all the PM_Eng_Names I have, with the value
0 for the materials that have no output transaction in the selected date
range Note: I got the perfect report when I remove the WHERE clause, but
the date is important for my project Anyone can help me please?
No comments:
Post a Comment