MySQL Forums
Forum List  »  PHP

Re: MySql Date Query
Posted by: Peter Brawley
Date: April 09, 2009 10:25AM

DROP TABLE IF EXISTS t;
CREATE TABLE t(t time,i int);
INSERT INTO t VALUES('01:01:01',1),('02:02:02',2),('05:05:05',5);

SELECT FLOOR(HOUR(t)/3) AS period, GROUP_CONCAT(i) AS i
FROM t
GROUP BY period;
+--------+------+
| period | i    |
+--------+------+
|      0 | 1,2  |
|      1 | 5    |
+--------+------+

PB
http://www.artfulsoftware.com

Options: ReplyQuote


Subject
Written By
Posted
April 09, 2009 12:27AM
Re: MySql Date Query
April 09, 2009 10:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.