with t as (select uid,artical_id,in_time as dt, 1 as flag from tb_user_log where artical_id!=0 union all select uid,artical_id,out_time as dt, -1 as flag from tb_user_log where artical_id!=0) select w.artical_id ,max(w.cc) z from (select artical_id, sum(flag) over(partition by artical_id order by d...