帆软用户77r8vnVzDX(提问者)SELECT
date( intime ) AS login_date,
max( online_user_cnt ) AS online_user_cnt_max
FROM
(
SELECT
userid,
intime,
sum( index1 ) over ( ORDER BY intime ASC ) AS online_user_cnt
FROM
( SELECT userid, intime, 1 AS index1 FROM login UNION ALL SELECT userid, ontime, - 1 AS index1 FROM login ) a
) b
GROUP BY
date( intime )
这样也可以