Od liczby tygodni do tej pory
"select WEEK(date) as week," \
"sum(marks) as marks, sum(marks2) as marks2," \
"sum(marks3) as marks3,sum(marks4) as marks4," \
"sum(marks5) as marks5, sum(marks6) as marks6, " \
"DATE_ADD(date, INTERVAL(1-DAYOFWEEK(date)) DAY) as start_date," \
"DATE_ADD(date, INTERVAL(7-DAYOFWEEK(date)) DAY) as end_date " \
"from test_ashu_marks where subject not like '%math%' and " \
"date >= DATE_ADD(CURDATE(), INTERVAL - 31 DAY) " \
"group by week,start_date,end_date order by week desc"
Matz Leeflang