题解 | 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-14 20:10
已编辑
门头沟学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务