我的表中有一个时间戳值,它设置为更新当前时间戳。
当用户执行 x 工作时,它会自行更新。
我想计算过去 30 分钟内有多少用户完成了 x 工作。我需要什么 mysql 查询?
您应该使用计数聚合函数您的查询
select
count(timestampColumnName)
from
yourtable
where
timestampColumnName>date_sub(now(), interval 30 minute)
// and any other conditions as needed