Lilly
Lilly

Reputation: 233

SQL to select current month MS Access

I'm wondering if it it possible to SELECT records in which [RRRmonth] field is the current month? I've written this SQL in many ways and can't seen to get it to work.

SELECT CFRRR.CFRRRID, CFRRR.[program], CFRRR.[language]
FROM CFRRR
WHERE (((CFRRR.[workername]) Is Null) AND ((CFRRR.RRRmonth)=Month([RRRmonth])));

Thanks!

Upvotes: 0

Views: 1689

Answers (1)

Robbert
Robbert

Reputation: 6582

The month function will give you the month of a date/time field. The date function will give you the current date. Use the two together will give you the answer you're looking for

SELECT CFRRR.CFRRRID, CFRRR.[program], CFRRR.[language]
FROM CFRRR
WHERE CFRRR.[workername] Is Null AND month(CFRRR.[RRRmonth])=month(Date());

You also don't need all those parenthesis and makes for a messy query.

Upvotes: 1

Related Questions