Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Support SUM(something1) OVER (ORDER BY something2) syntax #758

Open
zurk opened this issue Jun 20, 2019 · 0 comments
Open

Support SUM(something1) OVER (ORDER BY something2) syntax #758

zurk opened this issue Jun 20, 2019 · 0 comments
Assignees
Labels

Comments

@zurk
Copy link

zurk commented Jun 20, 2019

There is a special window function in MYSQL to calculate complex aggregations.

For example, if you have a column with values [1, 1, 2, 2] and want to get cumulative sum, i.e [1, 1+1, 1+1+2, 1+1+2+2] You should run a query like

SELECT
    number, 
    SUM(number) OVER (ORDER BY date) AS cum_number 
FROM 
    table;

I am interested only in cumulative sum but there are more use cases (see https://mysqlserverteam.com/mysql-8-0-2-introducing-window-functions/)

@juanjux juanjux self-assigned this Oct 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants