题解 | 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)

全部评论

相关推荐

06-25 16:53
门头沟学院 Java
人力小鱼姐:简历可以直接用飞书模板 模拟面试可以试试ai,现在好多都还是免费阶段 像Sugar云面、多面鹅都不错,主要看面试后自己能不能复盘出有效信息
为了找工作你花了哪些钱?
点赞 评论 收藏
分享
牛客38347925...:9,2学生暑期实习失利开始投小厂,给这群人整自信了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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