Re: [ADMIN] windown function count Unexpected results - Mailing list pgsql-admin

From David G. Johnston
Subject Re: [ADMIN] windown function count Unexpected results
Date
Msg-id CAKFQuwZiaZdre==Pbe-wgg_gO_eFWbNNakB+0ZgwBYEsstTAfA@mail.gmail.com
Whole thread Raw
In response to [ADMIN] windown function count Unexpected results  (winston cheung <winston_cheung@163.com>)
List pgsql-admin
On Thursday, May 4, 2017, winston cheung <winston_cheung@163.com> wrote:
, why the value of each line are different?

 window w as (partition by department_id order by salary desc);


This isn't an admin question; general or novice would be a better mailing list.

The answer is you added an order by clause to your window definition.  The docs explain why doing that results in each row of the partition only summing the rows before and including the current row.

David J. 

pgsql-admin by date:

Previous
From: winston cheung
Date:
Subject: [ADMIN] windown function count Unexpected results
Next
From: Steven Chang
Date:
Subject: Re: [ADMIN] windown function count Unexpected results