with t1 as ( select artical_id, in_time as at_time, 1 as uv from tb_user_log where artical_id!=0 union all select artical_id, out_time as at_time, -1 as uv from tb_user_log where artical_id!=0 ), t2 as( ...