Total Monthly Visitors (1 Viewer)

gregorg

Registered User.
Local time
Today, 06:05
Joined
Jul 26, 2006
Messages
56
Hi I am trying to create query that will show the "total number of visitors we have each month".

Just now each visit creates a record with the time and date of the visit

e.g. 11/12/2010 10:05:33

I need to extract the month and year from each record and total the number for each month, (so i can see the total number of visitors for each month.)

Can you help me with this ?

Gregorg.
 

jdraw

Super Moderator
Staff member
Local time
Today, 02:05
Joined
Jan 23, 2006
Messages
15,364
This is the general syntax

SELECT Month([YourVisitDate]) AS Mth, Count(YourVisitDate) AS CountOfVisits
FROM YourTableName
GROUP BY Month([YourVisitDate]);
 

vbaInet

AWF VIP
Local time
Today, 06:05
Joined
Jan 22, 2010
Messages
26,374
This is the general syntax

SELECT Month([YourVisitDate]) AS Mth, Count(YourVisitDate) AS CountOfVisits
FROM YourTableName
GROUP BY Month([YourVisitDate]);
... and based on jdraw's good advice, if you want each month per year you can do:
Code:
SELECT Format([YourVisitDate], "mm yyyy") AS Mth_Yr, Count(YourVisitDate) AS CountOfVisits
FROM YourTableName
GROUP BY Format([YourVisitDate], "mm yyyy");
 

Users who are viewing this thread

Top Bottom