Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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);
Comment

PREVIOUS NEXT
Code Example
Sql :: left join vs inner join performance 
Sql :: select a row include list of array with join table SQL 
Sql :: sqlserver: reverse like search 
Sql :: does laravel validate sql 
Sql :: visual c++ 2019 redistributable package mysql workbench 
Sql :: ring MySQL execute a query on the database then print the result. 
Sql :: tsql select concatenated values in one to many relationship 
Sql :: drop tables from local table database postgres 
Sql :: show database size or specific database table size 
Sql :: dataframe lambda elif 
Sql :: mamp find mysql port number mac 
Sql :: sql view postgresql 
Sql :: sql date range 
Sql :: update having mysql 
Sql :: tsql remove duplicate rows 
Sql :: opensuse stop MySQL 
Sql :: sql server run procedure on all databases 
Sql :: mybatis batch update oracle 
Sql :: get last row sqlite 
Sql :: datatype for phone number in sql 
Sql :: format datetime mysql 
Sql :: get all tables with column name sql 
Sql :: subquery in Delete 
Sql :: what is a stored procedure 
Sql :: utf8_encode mysql 
Sql :: sql into vs insert into 
Sql :: open mysql port bitnami tomact 
Csharp :: c# yes or no dialog 
Csharp :: c# check if type implements interface 
Csharp :: camera follow 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =