G
Guest
What is the most efficient way to filter or sum by month when individual
records have a date field?
I have tried this in my Where clause:
Where Month([FieldName])= Month([CriteriaDate]) AND Year([FieldName]) =
Year([CriteriaDate])
It just seems a little cumbersome to separate the month and year on both
sides, then compare against the month and year. I have considered calculating
the first/last days of each month, then doing a BETWEEN, but that might be
even more tricky.
Would it be more efficient to just generate a single number (e.g. MonthYear
of each value as Year(value)*100 + Month(value) and then compare the results?
Or is there some simple Month/Year function I have missed somewhere?
records have a date field?
I have tried this in my Where clause:
Where Month([FieldName])= Month([CriteriaDate]) AND Year([FieldName]) =
Year([CriteriaDate])
It just seems a little cumbersome to separate the month and year on both
sides, then compare against the month and year. I have considered calculating
the first/last days of each month, then doing a BETWEEN, but that might be
even more tricky.
Would it be more efficient to just generate a single number (e.g. MonthYear
of each value as Year(value)*100 + Month(value) and then compare the results?
Or is there some simple Month/Year function I have missed somewhere?