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