select dt,round(sum(date_diff)/count(distinct(uid)),1) as avg_view_len_scan from(
select uid,timestampdiff(second,in_time,out_time) date_diff,date_format(in_time,'%Y-%m-%d') dt from tb_user_log where in_time like '2021-11%' and artical_id != 0
)a group by dt
order by avg_view_len_scan 





还可以~