select artical_id,max(max_uv) as max_uv

from (

select artical_id,

sum(diff) over (partition by artical_id order by dt rows between unbounded preceding and current row) as max_uv

from (select artical_id,in_time dt,1 as diff

from tb_user_log 

where artical_id != 0

union all

select artical_id,out_time dt,-1 as diff

from tb_user_log

where artical_id != 0

order by dt) as a) as a

group by 1

order by 2 desc