难点在于计算某时刻在看人数!!!解题关键应用窗口函数计算,大概思路就是 sum(uv) over (partition by artical_id order by time) 首先,计算每一时刻的人数变动 每条记录的进入时间表示进入人数多了1:SELECT artical_id, in_time as dt,1 as uv FROM tb_user_log 每条记录的离开时间表示离开人数多了1:SELECT artical_id, out_time as dt, -1 as uv FROM tb_user_log ...