mysql sum per week

Solutions on MaxInterview for mysql sum per week by the best coders in the world

showing results for - "mysql sum per week"
Ariadna
14 Mar 2017
1SELECT 
2  SUM(nb_like) AS nb_like, 
3  CONCAT
4  (
5    STR_TO_DATE(CONCAT(YEARWEEK(date, 2), ' Sunday'), '%X%V %W'),
6    '-',
7    STR_TO_DATE(CONCAT(YEARWEEK(date, 2), ' Sunday'), '%X%V %W') + INTERVAL 6 DAY
8  ) AS week
9FROM fb_stats
10GROUP BY YEARWEEK(date, 2)
11ORDER BY YEARWEEK(date, 2);
12
similar questions
queries leading to this page
mysql sum per week