周一到周日 算一个周期
SELECT
date_sub(d.date,interval WEEKDAY(d.date) day) as weekStart, date_sub(d.date,interval WEEKDAY(d.date) -6 day) as weekEnd,
DATE_FORMAT(d.date, ‘%Y%u’) weeks
FROM
weeks d
周一到周日 算一个周期
SELECT
date_sub(d.date,interval WEEKDAY(d.date) day) as weekStart, date_sub(d.date,interval WEEKDAY(d.date) -6 day) as weekEnd,
DATE_FORMAT(d.date, ‘%Y%u’) weeks
FROM
weeks d