Last Updated: February 25, 2016
·
1.124K
· sunng

Mysql group by week

YEARWEEK() function returns a concat of year and week number, which is useful for such kind of query.

select yearweek(current_timestamp());

+-------------------------------+
| yearweek(current_timestamp()) |
+-------------------------------+
|                        201346 |
+-------------------------------+