Answers for "mysql sum per week"

SQL
0

mysql sum per week

SELECT 
  SUM(nb_like) AS nb_like, 
  CONCAT
  (
    STR_TO_DATE(CONCAT(YEARWEEK(date, 2), ' Sunday'), '%X%V %W'),
    '-',
    STR_TO_DATE(CONCAT(YEARWEEK(date, 2), ' Sunday'), '%X%V %W') + INTERVAL 6 DAY
  ) AS week
FROM fb_stats
GROUP BY YEARWEEK(date, 2)
ORDER BY YEARWEEK(date, 2);
Posted by: Guest on September-05-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language