题解 | #统计自然周平均登录次数情况#

统计自然周平均登录次数情况

https://www.nowcoder.com/practice/4655e5dfa8f64166875d6f77558a1fc8

select week_begin,
round(count(*)/count(distinct uid),2) as avg_times
from 
(select uid,date_sub(login_date,interval (weekday(login_date)) day) as week_begin from user_login_tb) a
group by week_begin
order by week_begin;
全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务