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 |
+-------------------------------+
Written by Sun Ning
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Related Tags
#mysql
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#