Re: [QUESTION] Window function with partition by and order by - Mailing list pgsql-sql

From Tom Lane
Subject Re: [QUESTION] Window function with partition by and order by
Date
Msg-id 355604.1669566484@sss.pgh.pa.us
Whole thread Raw
In response to [QUESTION] Window function with partition by and order by  (Ankit Kumar Pandey <itsankitkp@gmail.com>)
Responses Re: [QUESTION] Window function with partition by and order by
List pgsql-sql
Ankit Kumar Pandey <itsankitkp@gmail.com> writes:
> Question is: Average of id for partition name (A) should be 6/4 = 1.5 
> for all rows in that partition but this result is seen only at the last 
> one row in partition (A). Am I missing here something?

https://www.postgresql.org/docs/current/tutorial-window.html

particularly:

    By default, if ORDER BY is supplied then the frame consists of all
    rows from the start of the partition up through the current row, plus
    any following rows that are equal to the current row according to the
    ORDER BY clause.

            regards, tom lane



pgsql-sql by date:

Previous
From: Samed YILDIRIM
Date:
Subject: Re: [QUESTION] Window function with partition by and order by
Next
From: Ankit Kumar Pandey
Date:
Subject: Re: [QUESTION] Window function with partition by and order by