Re: Understanding Aliases
От | Stanislav Raskin |
---|---|
Тема | Re: Understanding Aliases |
Дата | |
Msg-id | E1J29DP-00046f-00@teena.zerebecki.de обсуждение исходный текст |
Ответ на | Re: Understanding Aliases (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Understanding Aliases
|
Список | pgsql-general |
> 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 the WHERE-statement, but also want to fetch the result of this subquery. I think that this would be the correct way to do so: 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 ) Will the subquery be evaluated twice, or is postgres smart enough to somehow cache the result from the first call of the subquery? Kind Regards Stanislav Raskin
В списке pgsql-general по дате отправления: