LookitsPuck
May 7th, 2004, 12:01 PM
Hey all!
I'm a newbie SQL'er. I know the basics and whatnot, however, I have an issue. I have a database in which I'm trying to count the number of times a day an event happens. However, the field that I'm grouping by has a date/time field. If I count on that field and group by that field, every item will have a count of one since it's counting based upon date and time instead of date. I'd be hard pressed to find an event that occurred at the same day at the same time (example, 2 events occuring at 5/07/04 at 4:00PM). Now say 7 events occurred on 5/07/04, I want to be able to count those. Is there a way just to count based upon the grouping of JUST the date portion of the date/time variable?
Here's the SQL statement I have currently:
SELECT Count(Initial.planned_start) AS JustDate
FROM Initial
WHERE (((Initial.planned_start)<>False)) GROUP BY Initial.planned_start;
planned_start is a date/time field. How would I have it group by planned_start's date portion instead of both date and time?
Thanks,
-Steve
I'm a newbie SQL'er. I know the basics and whatnot, however, I have an issue. I have a database in which I'm trying to count the number of times a day an event happens. However, the field that I'm grouping by has a date/time field. If I count on that field and group by that field, every item will have a count of one since it's counting based upon date and time instead of date. I'd be hard pressed to find an event that occurred at the same day at the same time (example, 2 events occuring at 5/07/04 at 4:00PM). Now say 7 events occurred on 5/07/04, I want to be able to count those. Is there a way just to count based upon the grouping of JUST the date portion of the date/time variable?
Here's the SQL statement I have currently:
SELECT Count(Initial.planned_start) AS JustDate
FROM Initial
WHERE (((Initial.planned_start)<>False)) GROUP BY Initial.planned_start;
planned_start is a date/time field. How would I have it group by planned_start's date portion instead of both date and time?
Thanks,
-Steve