Question

I have a table with a timestamp column as this:

2013-04-05 22:33:50

2013-04-05 22:42:03

2013-04-05 22:42:03

I want to make a SELECT on it and receive results with seconds 00 and minutes rounded down to nearest 10. As:

2013-04-05 22:30:00

2013-04-05 22:40:00

2013-04-05 22:40:00

How is this done? I cannot update or insert on the table, only select.

Was it helpful?

Solution

Here you go:

SELECT DATE_SUB(DATE_SUB(ticktick, INTERVAL MOD(MINUTE(ticktick),10) MINUTE), INTERVAL SECOND(ticktick) SECOND) FROM `table`
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top