with t1 as ((select artical_id,in_time dt,1 diff from tb_user_log where artical_id!=0) union all (select artical_id,out_time dt,-1 diff from tb_user_log where artical_id!=0)), t2 as (select artical_id,sum(diff) over(partition by artical_id order by dt,diff desc ) cur_uv from t1) select artical_id,ma...