此处按15天为一期分组
SELECT
sum(logintime) as logintime,CONCAT("(",LEFT ( MIN( date ), 10 ),"至",LEFT ( MAX( date ), 10 ),")") AS date_range,CONCAT('第',FLOOR(DATEDIFF(date,'2022-08-11')/15)+1,'期') AS weeks
FROM
user
WHERE
date >= "2022-08-11" and date <= "2022-09-30"
GROUP BY
weeks
查询结果: