先看效果
image.png
SELECT
vid,FROM_UNIXTIME(time,'%Y-%m-%d %H') AS Hour,
count(*) AS Count
FROM
vote_detail
WHERE
FROM_UNIXTIME(time, '%Y-%m-%d %H') < '2019-06-25 17'
and
vid =12
GROUP BY
FROM_UNIXTIME(time,'%Y-%m-%d %H')
HAVING count(*) >20
ORDER BY
FROM_UNIXTIME(time,'%Y-%m-%d %H');
亲测有效
网友评论