I have a table that looks like this
CREATE TABLE `time_table` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
`creationDate` DATETIME NOT NULL,
PRIMARY KEY (`id`)
)
I basically store the creation time of certain records in the table. I know if I want to get a count of the records that were created in 15 mins interval I will use something like this
SELECT FLOOR(UNIX_TIMESTAMP(creationDate)/900) AS t,
COUNT(*) FROM time_table
GROUP BY t
That gives me something like this
t COUNT(*)
1434187 1
1434188 3
1434189 2
1434190 2
How do I make sense of the first column? If I want it to show me something like
t COUNT(*)
2:00pm - 2:15pm 1
2:15pm - 2:30pm 3
2:30pm - 2:45pm 2
2:45pm - 3:00pm 2
I understand that with some manipulation I could get 1434187 to show up at 2:15pm. Even that might be a good start….then with some logic I could show the entire period. Thanks!
One way is to just use
>and<in order to get everything within a range, but you may find this to be simpler:from
http://forums.mysql.com/read.php?10,202789,202807