How to group by week in MySQL?
You can use both YEAR(timestamp) and WEEK(timestamp), and use both of the these expressions in the SELECT and the GROUP BY clause. Not overly elegant, but functional… And of course you can combine these two date parts in a single expression as well, i.e. something like SELECT CONCAT(YEAR(timestamp), “https://stackoverflow.com/”, WEEK(timestamp)), etc… FROM … WHERE .. … Read more