Php 如何使用epoch和mysql计算每小时?

Php 如何使用epoch和mysql计算每小时?,php,mysql,Php,Mysql,如何在24小时内的每小时之间创建计数行 我有一张这样的桌子 [ID] [Time(epoch time)] 谢谢我希望我已经理解了你的问题 select from_unixtime(visittime,'%H') as h,count(*) as total from table where from_unixtime(visittime) >= now() - interval 1 day group by h 我希望我已经理解了你的问题 select from_unixtime(v

如何在24小时内的每小时之间创建计数行

我有一张这样的桌子

[ID] [Time(epoch time)]

谢谢

我希望我已经理解了你的问题

select from_unixtime(visittime,'%H') as h,count(*) as total
from table
where from_unixtime(visittime) >= now() - interval 1 day
group by h

我希望我已经理解了你的问题

select from_unixtime(visittime,'%H') as h,count(*) as total
from table
where from_unixtime(visittime) >= now() - interval 1 day
group by h

你能把问题扩大一下吗?我有点不确定您需要什么。您想要跟踪每24小时创建的行或最近24小时创建的记录吗?只需检查答案,基本上我需要获取过去一天中每小时的记录计数。:)你能把问题扩大一下吗?我有点不确定您需要什么。您想要跟踪每24小时创建的行或最近24小时创建的记录吗?只需检查答案,基本上我需要获取过去一天中每小时的记录计数。:)是的,就是这样,我是如何编辑的:从unixtime(
VisitTime
,'%H%m/%d/%y')中选择H,将(*)计算为日志中的总数,其中
VisitTime
>1303134630按hyep分组,就是这样,我是如何编辑的:从unixtime(
VisitTime
,'%H%m/%d/%y')中选择H,计数(*)作为日志的总计,其中
访问时间
>1303134630按小时分组