Simple Date Query

J

Joe Spenceley

Hi,

I have a field which is general date and contains dd//mm/yy hh:mm:ss.

I want to count number of records for each date.

e.g. something like

SELECT Count(Messages.MessageID) AS CountMessage, Messages.DateStamp
FROM Messages
GROUP BY Messages.DateStamp;

This groups by the time rather than the date. I've looked at using DatePart
to construct a query but that is looking rather clumsy. Is there a more
efficient way of doing this?

Cheers,
Joe
 
M

Marshall Barton

Joe said:
I have a field which is general date and contains dd//mm/yy hh:mm:ss.

I want to count number of records for each date.

e.g. something like

SELECT Count(Messages.MessageID) AS CountMessage, Messages.DateStamp
FROM Messages
GROUP BY Messages.DateStamp;

This groups by the time rather than the date. I've looked at using DatePart
to construct a query but that is looking rather clumsy.


Try:

GROUP BY DateValue(DateStamp)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Date Function in query 3
Query to Update Date 2
Filtering Criteria Question 2
Date comparison 2
Date Parameter 7
Cross-tab Criteria not evaluating 19
query on date 1
Query Based on Weekdays vs Weekend 4

Top