- 取得連結
- X
- 以電子郵件傳送
- 其他應用程式
SQL Group BY 10 Minutes
SELECT COUNT(id) AS `數量`, CONCAT(DATE_FORMAT(create_time,'%Y-%m-%d %H:'),FLOOR(DATE_FORMAT(create_time,"%i")/10),'0:00', ' ~ ',DATE_FORMAT(create_time,'%Y-%m-%d %H:'),FLOOR(DATE_FORMAT(create_time,"%i")/10),'9:59') AS `時間區間`
FROM table
WHERE create_time BETWEEN '2013-10-16 17:00:00' AND '2013-10-16 17:59:59'
GROUP BY FLOOR(DATE_FORMAT(create_time,"%i")/10)
;
留言