题解 | 2021年11月每天的人均浏览文章时长

select date (in_time) dt, round(sum(TIMESTAMPDIFF(second, in_time, out_time))/count(distinct uid),1)avg_viiew_len_sec
from tb_user_log
where year(in_time) = 2021 and month(in_time) = 11
and year(out_time) = 2021 and month(out_time) = 11
and artical_id !=0
group by date (in_time)
order by avg_viiew_len_sec

注意:

①date()函数直接求出来了年-月

②uid要去去重

③sum(TIMESTAMPDIFF(second, in_time, out_time)

全部评论

相关推荐

本科生是不是只能去送外卖了
有气魄的海豚在喝茶:外卖这个版本被保安克制
点赞 评论 收藏
分享
04-03 12:09
東京大学 C++
求求求求暑期offer:留第一行,剩下的不要
点赞 评论 收藏
分享
04-05 21:13
邯郸学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务