SELECT COUNT(r.user_id) AS users, HOUR(r.created) data_hour, FROM_UNIXTIME(unix_timestamp(r.created), "%Y-%m-%d") data_date
FROM record r
WHERE r.created BETWEEN :date_from AND :date_till
GROUP BY data_hour, data_date
ORDER BY data_date, users, data_hour DESC
假设 r.created 是类似 2014-04-03 09:04:00