[SQL] column alias and group by/having/order

2004-06-01 Thread Tomasz Myrta
Hi I found some strange column alias behaviour: select val1+val2 as val from some_table group by val; result - OK select val1+val2 as val from some_table order by val; result - OK select val1+val2 as val from some_table group by val having val1+val2>1; result - OK select val1+val2 as val from some_

Re: [SQL] column alias and group by/having/order

2004-02-13 Thread Tom Lane
Tomasz Myrta <[EMAIL PROTECTED]> writes: > I found some strange column alias behaviour: That's how it is. The fact that you can reference output-column aliases at all in GROUP BY or ORDER BY is a wart, because it conflicts with the logical model of query evaluation --- the output list should be c

Re: [SQL] column alias and group by/having/order

2004-02-13 Thread Rod Taylor
> select val1+val2 as val > from some_table > group by val having val>1; > ERROR: Attribute "val" not found > > Is it a bug or a feature? It's a mis-feature that group by accepts aliases of the select list. Having is proper. ---(end of broadcast)--