select dt,round(sum(sumtime)/count(cnt),1) as avg_viiew_len_sec from (select dt,uid,count(uid) as cnt, sum(times) as sumtime from (select uid, artical_id, timestampdiff(second, in_time, out_time) as times, date (in_time) as dt fro...