MySQL
- 3 ответа
- 0 вопросов
4
Вклад в тег
SELECT
DATE_FORMAT(`start_date`, '%x-%v') weeks,
COUNT(*), DATE_ADD(`start_date`, INTERVAL(2-DAYOFWEEK(`start_date`)) DAY) first_date,
DATE_ADD(`start_date`, INTERVAL(8-DAYOFWEEK(`start_date`)) DAY) last_date
FROM `events` GROUP BY weeks;