Re: 2nd attempt: Window function SQL - can't quite figure it.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Pál Teleki <ellenallhatatlan(at)gmail(dot)com>
Cc: pgsql-novice novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: 2nd attempt: Window function SQL - can't quite figure it.
Date: 2016-07-18 23:18:35
Message-ID: CAKFQuwbfsy+2Z8WQXn6nyDQVpADwYje7LvAg5pWrP-R9t5OhnQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Monday, July 18, 2016, Pál Teleki <ellenallhatatlan(at)gmail(dot)com> wrote:

> Now, why can't I use deptot and stot_per_man aliases in my query? It would
> greatly simplify the SQL by removing the need for a subquery (or inline
> view
> as Oracle calls them).
>

SQL execution of a query is only done once. Referring to an alias at the
same level in a query would require some kind of duplication to work.
Either two phase processing or cloning the subselect that is being alised
and executing it a second time to be used in the second location. Neither
are desirable.

David J.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Pál Teleki 2016-07-19 01:21:14 Re: 2nd attempt: Window function SQL - can't quite figure it.
Previous Message Pál Teleki 2016-07-18 21:43:19 Re: 2nd attempt: Window function SQL - can't quite figure it.