'MySql Query for running totals return same value for each years
I am not expert in MySql, what I am trying to do is, to create a query will returns the running totals by month and years:
SELECT DISTINCT
date_format(t.created_at, "%M") AS month,
date_format(t.created_at, "%Y") AS year,
SUM(COUNT(*)) over (order by MONTH(created_at) ) as cumulative
FROM team t
GROUP BY YEAR(created_at), MONTH(created_at)
ORDER BY MONTH(created_at) ASC
Query results: enter image description here
Anyone know how to solve this? :(
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
