Re: WHERE on an alias

Поиск
Список
Период
Сортировка
От Joseph Shraibman
Тема Re: WHERE on an alias
Дата
Msg-id 3B86AB82.9040501@selectacast.net
обсуждение исходный текст
Ответ на WHERE on an alias  (Joseph Shraibman <jks@selectacast.net>)
Ответы Re: WHERE on an alias
Список pgsql-sql
That was just an example.  My code doesn't use group by, it uses a subselect.  And I 
checked and having doesn't work with aliases either.

Stephan Szabo wrote:
> On Fri, 24 Aug 2001, Joseph Shraibman wrote:
> 
> 
>>playpen=# select a, sum(b) as dsum from taba where dsum > 5 group by(a);
>>ERROR:  Attribute 'dsum' not found
>>
>>Why can we GROUP BY on an alias but not do a WHERE on an alias?  I have a subselect that 
>>explain shows is being run twice if I have to put it in the WHERE clause.
>>
> 
> Somewhat unrelated question, are you sure you want where and not having?
> IIRC, where is going to select rows before things like the group by
> occur, and that doesn't seem to be what you'd want here, right?
> 


-- 
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio.  http://www.targabot.com



В списке pgsql-sql по дате отправления:

Предыдущее
От: Joseph Shraibman
Дата:
Сообщение: WHERE on an alias
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: WHERE on an alias