Below is the SQL I have for a query. This query finds
WU Totals, Leak Totals, and pct of leaks for me and works
fine. It is also based on a date range. What I would like
to know is, say if the date range is 6/1/08-6/30/08 and
there are some dates that do not have any information, is
there a way for me to make each date in the range show
and populate zero's if there is no info?
WU Totals, Leak Totals, and pct of leaks for me and works
fine. It is also based on a date range. What I would like
to know is, say if the date range is 6/1/08-6/30/08 and
there are some dates that do not have any information, is
there a way for me to make each date in the range show
and populate zero's if there is no info?
Code:
SELECT Format(TodaysDate,'yyyy-mm-dd') AS [Date], WU.[WU Totals], Count(*) AS [Leak Totals], (Count(*)/WU.[WU Totals]*1) AS [Percent]
FROM WorkUnitsFaultsMainTBL, [SELECT vTbl.Day as WUDay,
Count(*) AS [WU Totals]
FROM
(SELECT DISTINCT Format(TodaysDate,'yyyy-mm-dd') AS [Day], WorkUnit
FROM WorkUnitsFaultsMainTBL
WHERE BuildID IN ('E010','C809','F001','C810','F187','A910','M173','M174')
AND (TodaysDate BETWEEN [Forms]![Queries_ReportsFRM]![StartDateTxt]
And [Forms]![Queries_ReportsFRM]![EndDateTxt])) AS vTbl
GROUP BY vTbl.Day ]. AS WU
WHERE (((WorkUnitsFaultsMainTBL.Problem) Like "*leak*") AND ((WorkUnitsFaultsMainTBL.TodaysDate) Between [Forms]![Queries_ReportsFRM]![StartDateTxt] And [Forms]![Queries_ReportsFRM]![EndDateTxt]) AND ((WorkUnitsFaultsMainTBL.BuildID) In ("E010","C809","F001","C810","F187","A910","M173","M174")) AND ((Format([TodaysDate],'yyyy-mm-dd'))=[WU].[WUDay]))
GROUP BY Format(TodaysDate,'yyyy-mm-dd'), WU.[WU Totals]
ORDER BY Format(TodaysDate,'yyyy-mm-dd'), WU.[WU Totals], Count(*) DESC;