List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 1 2003 4:24pm
Subject:Re: Group by Date in Datetime field
View as plain text  
At 8:27 -0700 5/1/03, Karl J. Stubsjoen wrote:
>Hello,
>I have a field of type datetime.  I need to group on variations of a 
>date or time value.
>
>I'd like to perform the following groups:
>1)  grouping by Day
>2)  grouping by Week
>3)  grouping by Month
>
>I'd like to perform the following groups by time:
>1)  group by hour (in chronologic order)
>         "for the last 6 hours x records are found each hour"

GROUP BY FROM_DAYS(TO_DAYS(d)), HOUR(d)

will group by date and hour

>2)  group by hour (in an extracted sense of hour)
>         "at 3 o'clock every day x records are found in the table"

GROUP BY HOUR(d)

>
>
>Is this possible from one DateTime Field?  Or, do I need to create a 
>seperate field for each value I intend to group on:  one for the 
>year, one for the month, one for the day, one for the week, and so 
>on...
>
>Thanks, Karl

Thread
Group by Date in Datetime fieldKarl J. Stubsjoen1 May
  • Re: Group by Date in Datetime fieldPaul DuBois1 May