window

UNBOUNDED FOLLOWING

Ends the frame at the partition end. Starting at the current row gives a suffix total. It cannot be a frame start. Example target: PostgreSQL 17; focused usage form.

Formal Syntax & Structure

sql syntaxsql
SUM(x) OVER (PARTITION BY g ORDER BY x,id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)

Working Example

Example Snippetsql
WITH t(id,g,x) AS (VALUES (1,'A',10),(2,'A',20),(3,'A',20),(4,'A',40),(5,'B',7)) SELECT id, SUM(x) OVER (PARTITION BY g ORDER BY x,id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS result FROM t ORDER BY id;
SQL Reference