PDA

View Full Version : Solved: Curent Month Query



IgnBan
04-09-2008, 05:48 AM
I have this query to extract the number of Audits conducted in current month;
SELECT Count(Audits.Audit_ID) AS NumberOfAudits, Month([Date]) AS [Month]
FROM Audits
GROUP BY Month([Date])
HAVING (((Month([Date]))=Month(Now())));

This Db is two years old. How can I extract just this (2008) current Month? I noticed that is I use this query it adds the two years.

IgnBan
04-09-2008, 06:15 AM
Sorry guys, I forgot to put year;
SELECT Count(Audits.Audit_ID) AS CountOfAudit_ID, Month([Date]) AS [Month], Year([Date]) AS [Year]
FROM Audits
GROUP BY Month([Date]), Year([Date])
HAVING (((Month([Date]))=Month(Now())) AND ((Year([Date]))=Year(Now())));

Thanks again