subquery question

Поиск
Список
Период
Сортировка
От Tom Raney
Тема subquery question
Дата
Msg-id 4984E91B.5010000@comcast.net
обсуждение исходный текст
Ответы Re: subquery question
Список pgsql-novice
I've dug around on the Postgres lists for a bit and I haven't found a
good explanation of why this query is not allowed.

SELECT Temp.team_id, Temp.count_agents
FROM (SELECT TR.team_id, COUNT(TR.agent_id) AS count_agents
      FROM teamrel TR
      GROUP BY TR.team_id ) AS Temp
WHERE Temp.count_agents = (SELECT MIN (Temp.count_agents) FROM Temp)

I know that column aliases are not accessible in the WHERE clause, but why can't we access outer table aliases in a
subqueryFROM clause?  Is the table alias rewritten into the select clause? 

-Tom




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

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: Select START and MAXVALUE from Sequence
Следующее
От: Richard Broersma
Дата:
Сообщение: Re: subquery question