Re: windown function count Unexpected results

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: winston cheung <winston_cheung(at)163(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: windown function count Unexpected results
Date: 2017-05-05 04:15:16
Message-ID: CAKFQuwZiaZdre==Pbe-wgg_gO_eFWbNNakB+0ZgwBYEsstTAfA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thursday, May 4, 2017, winston cheung <winston_cheung(at)163(dot)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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Steven Chang 2017-05-05 04:42:14 Re: windown function count Unexpected results
Previous Message winston cheung 2017-05-05 03:31:21 windown function count Unexpected results