> SELECT-list output aliases name the *output* columns of the SELECT.
> Those output columns are not available to the SELECT's computation
> clauses
Then it's unclear how could the first query work
]
Gesendet: Dienstag, 11. Dezember 2007 19:54
An: Stanislav Raskin
Cc: pgsql-general@postgresql.org
Betreff: Re: [GENERAL] Understanding Aliases
> SELECT-list output aliases name the *output* columns of the SELECT.
> Those output columns are not available to the SELECT's computatio
> should do the trick without double select, or?
Indeed it seems to do so. The cost estimation is even about 10 times less
with the real application's queries.
I never really used group/having even though being aware of their existence.
I probably should do so more often.
Stanislav,
SELECT
>t2.id,
>(SELECT COUNT(id) FROM t4 WHERE t2_id = t2.id AND value=10)
> AS t4_num
> FROM
>t2
> WHERE
>t2.active
>AND (
> (SELECT COUNT(id) FROM t4 WHERE t2_id = t2.id AND value=10) <= 3
>)
>
>
> People frequently think that because ORDER BY can refer to the
> output-column aliases, other clauses should be able to do it too,
> but this is not so.
Thank you very much for clearing that one up.
Now I have a follow-up question. Let's assume that I want not only to
evaluate a subquery for th
"Stanislav Raskin" <[EMAIL PROTECTED]> writes:
> Still no Idea why it does not work with the alias.
SELECT-list output aliases name the *output* columns of the SELECT.
Those output columns are not available to the SELECT's computation
clauses. Otherwise you'd have a logical circularity --- by def
Note to self: works if I directly reference outer query column name from the
inner query.
Still no Idea why it does not work with the alias.
gresql.org
Betreff: [GENERAL] Understanding Aliases
Hello everybody,
I did encounter a behaviour of aliases on my postgresql 8.1, which I don't
quite understand.
Consider this schema layout:
CREATE TABLE t1
(
id serial NOT NULL,
t2_id integer NOT NULL,
t3_id integer NOT N
Hello everybody,
I did encounter a behaviour of aliases on my postgresql 8.1, which I don't
quite understand.
Consider this schema layout:
CREATE TABLE t1
(
id serial NOT NULL,
t2_id integer NOT NULL,
t3_id integer NOT NULL,
t1_name character varying(255),
CONSTRAINT t1_pke