select date_format(in_time,'%Y-%m-%d') as dt , round(sum(timestampdiff(second,in_time,out_time))/count(distinct uid),1) as avg_viiew_len_sec from tb_user_log#求平均值要注意ID要去重 where artical_id!=0 #这里要注意排除掉artical_id为0的 and year(in_time)=2021 and month(in_time)=11 group by dt order by avg_viiew_len_sec