gojets1721
Registered User.
- Local time
- Yesterday, 22:17
- Joined
- Jun 11, 2019
- Messages
- 430
I have a table of complaints dating back to 2014. There's roughly 10 thousand records. I inherited this DB and there's a query which filters down to YTD across all years (i.e. it only shows records between 1/1 through today across all years).
The query takes a while to load as opposed to all other queries. I'm not sure if its just because of the number of records or if the code used to do this filtering is not the most efficient. Any thoughts on ways to improve?
Here's the query's SQL code:
The query takes a while to load as opposed to all other queries. I'm not sure if its just because of the number of records or if the code used to do this filtering is not the most efficient. Any thoughts on ways to improve?
Here's the query's SQL code:
Code:
SELECT ComplaintNumber, ComplaintDate, ComplaintCategory
From qryAllComplaints
WHERE (((Format([ComplaintDate],"mmdd"))<Format(Date(),"mmdd")) AND ((Year([ComplaintDate]))>=Year(Date())-10))
ORDER BY ComplaintDate;