SQL 2023 · Aggregation and window functions

Compute a running total

Add up amounts in date order.

SELECT day, amount, SUM(amount) OVER (ORDER BY day) AS running_total FROM sales;

Official SQL 2023 documentation

More aggregation and window functions commands

All aggregation and window functions commands · SQL 2023 cheatsheet

Was this page helpful?