1,对一天24小时内每小时的数据量求和: SELECT IFNULL(SUM(CASE HOUR(时间字段) WHEN 0 THEN 1 ELSE 0 END),0)as '0', IFNULL(SUM(CASE HOUR(时间字段) WHEN 1 THEN 1 ELSE 0 END),0)as '1', IFNULL(SUM(CASE HOUR(时间字段) WHEN 2 THEN 1 ELSE 0 END),0) AS '2', IFNULL(SUM(CASE HOUR(时间字段) WHEN…