On Thu, Jan 15, 2009 at 6:28 PM, Alvaro Carrasco <[email protected]> wrote:
> Scott Hill wrote: > > I have a table with a datetime column and I want to group by week. Any > > ideas on how to do this with a MySQL query? The table has a timein > column, > > a timeout column and a column called elapsed. I want to sum the elapsed > for > > each week. I know I can do this in the where clause by specifying a date > > range but it is possible to do this with group by? > > > > Thanks, > > > > Have you tried: > > GROUP BY YEARWEEK(mydatetimecolumn) > > Alvaro > Yearweek did exactly what I was looking for. Thanks a bunch! -- Scott Hill Food for thought: A good pun is it's own reword. Energizer bunny arrested! Charged with battery! A pessimist's blood type is always B-negative. 42.7 percent of all statistics are made up on the spot. How much deeper would the ocean be without sponges? Atheism is a non-prophet organization. _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
