gpt4 book ai didi

php - 如何使用时间戳对元素进行计数

转载 作者:行者123 更新时间:2023-11-29 08:48:11 26 4
gpt4 key购买 nike

我的表中有一个时间戳值,并将其设置为更新当前时间戳。

当用户正在做某项工作时,它会自行更新。

我想计算过去 30 分钟内有多少用户进行了 x 工作。我需要什么 mysql 查询?

最佳答案

您应该使用count您的查询的聚合函数

select 
count(timestampColumnName)
from
yourtable
where
timestampColumnName>date_sub(now(), interval 30 minute)
// and any other conditions as needed

关于php - 如何使用时间戳对元素进行计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12022900/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com