Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有时间戳列的表,如下所示:
2013-04-05 22:33:50
2013-04-05 22:42:03
我想在它上面做一个 SELECT 并接收秒 00 和分钟四舍五入到最接近的 10 的结果。如:
2013-04-05 22:30:00
2013-04-05 22:40:00
这是怎么做到的?我无法更新或插入表格,只能选择。
干得好:
SELECT DATE_SUB(DATE_SUB(ticktick, INTERVAL MOD(MINUTE(ticktick),10) MINUTE), INTERVAL SECOND(ticktick) SECOND) FROM `table`