解决了连续后面就好写了; SELECT uid, DATE_FORMAT(dt,'%Y%m') AS MONTH, SUM(coins) AS coin FROM ( SELECT uid,first_day,dt,rn, CASE rn WHEN 3 THEN 3 WHEN 0 THEN 7 ELSE 1 END AS coins FROM ( SELECT uid,first_day,dt, ROW_NUMBER() OVER(PARTITION BY uid,first_day ORDER BY dt)...