I have a a query counting the number of records between two date values by week. It's specifically counting the number of days that a scheduled work order has in each accounting week. The query is taking an inconvenient amount of time to run and I'm not sure how to improve it.
Does anyone have any advice on how to speed it up or an alternative function to use?
This is the SQL:
Does anyone have any advice on how to speed it up or an alternative function to use?
This is the SQL:
Code:
SELECT [Adj and Filt MM214].[Work Area], [Adj and Filt MM214].[Work Order], [Adj and Filt MM214].[WA Scheduled Start], [Adj and Filt MM214].[WA Scheduled Complete Date], [Calendar Date w WK End].[Wk Ending], Count([Calendar Date w WK End].[Calendar Date]) AS [Days per Week]
FROM [Calendar Date w WK End], [Adj and Filt MM214]
WHERE ((([Calendar Date w WK End].[Calendar Date]) Between [wa scheduled start] And [wa scheduled complete date]))
GROUP BY [Adj and Filt MM214].[Work Area], [Adj and Filt MM214].[Work Order], [Adj and Filt MM214].[WA Scheduled Start], [Adj and Filt MM214].[WA Scheduled Complete Date], [Calendar Date w WK End].[Wk Ending];