SQL语句实例:
select count(id) as num from public.user where cast((CURRENT_TIMESTAMP-login_timed) day as integer )<=1;
或
select count(id) as num from public.user where cast((CURRENT_TIMESTAMP-login_timed) hour as integer )<=24;
大家可以根据表结构稍作调整后使用
本文提供两种SQL语句实例,用于统计在过去24小时内登录过的用户数量。第一种方法使用天数来衡量时间跨度,第二种方法则精确到小时。这两种方法均可根据实际表结构进行调整。
SQL语句实例:
select count(id) as num from public.user where cast((CURRENT_TIMESTAMP-login_timed) day as integer )<=1;
或
select count(id) as num from public.user where cast((CURRENT_TIMESTAMP-login_timed) hour as integer )<=24;
大家可以根据表结构稍作调整后使用
247
1145
406

被折叠的 条评论
为什么被折叠?