Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
CREATE TABLE tbl_users ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `activation_date` DATETIME ); INSERT INTO tbl_users (id, activation_date) VALUES (1, '2020-01-15' ), (2, '2020-02-13' ), (3, '2020-02-15' ), (4, '2020-03-01' ), (5, '2020-03-03' ), (6, '2020-05-01' ), (7, '2020-06-01' ), (8, '2020-07-15' ), (9, '2020-08-15' ), (10, '2020-08-15' ), (11, '2020-08-19' ); SELECT DISTINCT MONTH(activation_date) as month, SUM(1) over (order by MONTH(activation_date) )as cumulative FROM tbl_users WHERE activation_date >= '2020-01-15' ;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear