filtering only current month values

Ravi Kumar

Registered User.
Local time
Tomorrow, 01:20
Joined
Aug 22, 2019
Messages
162
Hi all ,
I have a query in which I need to filter only current month records , but using Month(now()) it is not filtering .
Below is my SQL , can you tell me how to do this?
SQL:
SELECT [OT and Absenteeism by month].[Date of Entry By Month], [OT and Absenteeism by month].[Sum Of OT (hrs)], [OT and Absenteeism by month].[Sum Of Absentees (hrs)], [OT and Absenteeism by month].[Count Of Master_table]
FROM [OT and Absenteeism by month];
 
I do not see you using Month(now()) ?

However, it would be along the lines of

Code:
Month([OT and Absenteeism by month].[Date of Entry By Month]) = Month(Now())
or

Code:
Month([OT and Absenteeism by month].[Date of Entry By Month]) = Month(Date)

HTH
 
you will probably need to add something about years as well.

and erm, spaces in column and table names :(
 
you will probably need to add something about years as well.

and erm, spaces in column and table names :(
Sorry , I try to avoid them ny using underscore but sometimes I forget ..will correct them
 
Hi Ravi. If by "current month" you mean from the 1st to the end of this month, then I prefer using a WHERE clause similar to this:

Code:
...WHERE DateField Between DateSerial(Year(Date()),Month(Date()),1) And DateSerial(Year(Date()),Month(Date())+1,0)
 

Users who are viewing this thread

Back
Top Bottom