Re: Group by -- precedence question

From: Jov <amutu(at)amutu(dot)com>
To: Joe Van Dyk <joe(at)tanga(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Group by -- precedence question
Date: 2013-03-23 03:03:58
Message-ID: CADyrUxOGiTASvQV_rt0oq6wXdmCO_UVGQCRB4L0Rum=_gw=Ekw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

jov
On Mar 23, 2013 9:26 AM, "Joe Van Dyk" <joe(at)tanga(dot)com> wrote:
>
> begin;
> create table f (v numeric);
> insert into f values (1), (0.8);
> select ceil(v) as v from f group by v;
>
> -- sorta expected the result to be grouped by the column alias,
> -- not by the in the table
>
> v
> ───
> 1
> 1
>
> This is the correct behavior, right? To group by the column alias, I'd
have to use "group by 1" or use a different name, right?
both right.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sergey Konoplev 2013-03-23 07:37:47 timeofday() and clock_timestamp() produce different results when casting to timestamptz
Previous Message Joe Van Dyk 2013-03-23 01:22:44 Group by -- precedence question