"chris smith" <[EMAIL PROTECTED]> writes:
> I assume it's this way because the standard says so..
Right. From a logical point of view, the HAVING clause has to be
evaluated before the output expressions are computed, so it doesn't
make any sense to expect the output expressions to be available in
On Fri, 31 Mar 2006, Andrus wrote:
> >> In real application I have long expression instead of 123 and do'nt want
> >> repeat this expression in HAVING clause.
> >
> > You have to repeat the expression. "AS" changes the output name, it
> > can't be used either in the where clause or any other limi
On Friday 31 March 2006 08:30, chris smith wrote:
> On 3/31/06, Andrus <[EMAIL PROTECTED]> wrote:
> > >> In real application I have long expression instead of 123 and do'nt
> > >> want repeat this expression in HAVING clause.
> > >
> > > You have to repeat the expression. "AS" changes the output na
On 3/31/06, Andrus <[EMAIL PROTECTED]> wrote:
> >> In real application I have long expression instead of 123 and do'nt want
> >> repeat this expression in HAVING clause.
> >
> > You have to repeat the expression. "AS" changes the output name, it
> > can't be used either in the where clause or any
Here is my problematic query which runs OK in other DBMS.
Only way to run this in Postgres is to duplicate reatasum expression two
times in HAVING clause, right ?
Andrus.
SELECT
'z' as doktyyp,
r1.dokumnr,
r1.kuluobjekt as objekt,
r1.rid2obj,
r1.rid3obj,
r1.rid4obj,
r1.rid5obj,
>> In real application I have long expression instead of 123 and do'nt want
>> repeat this expression in HAVING clause.
>
> You have to repeat the expression. "AS" changes the output name, it
> can't be used either in the where clause or any other limiting factor
> like 'having':
Doc about HAVING
On 3/31/06, Andrus <[EMAIL PROTECTED]> wrote:
> CREATE TEMP TABLE foo( bar integer );
>
> SELECT 123 AS x
> FROM foo
> GROUP BY 1
> HAVING x> AVG(bar)
>
> causes
>
> ERROR: column "x" does not exist
>
> Why ? How to make this working ?
>
> In real application I have long expression instead o