Re: SQL subquery to supply table name?

Поиск
Список
Период
Сортировка
От Scott Chapman
Тема Re: SQL subquery to supply table name?
Дата
Msg-id 200209261940.37792.scott_list@mischko.com
обсуждение исходный текст
Ответ на Re: SQL subquery to supply table name?  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: SQL subquery to supply table name?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
I was lead to believe that Postgresql would handle this from reading the docs.
This error message from psql made me think it would also:

select txtcompanyname from (select table_quest from reviews where
review_num=28) where review_num=28;

ERROR:  sub-SELECT in FROM must have an alias
        For example, FROM (SELECT ...) [AS] foo

What is the "sub-SELECT in FROM" supposed to be used for if not this usage?

Scott

On Thursday 26 September 2002 06:01 pm, Martijn van Oosterhout wrote:
> I think the basic response is "don't do that". SQL doesn't support queries
> where the tables are not predetermined. The query planner would have a
> terrible time since it would not be able to estimate costs prior to
> execution.
>
> Since all your "subtables" are likely to have the same structure, why not
> store them all in one table. Any particular reason?


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

Предыдущее
От: Scott Chapman
Дата:
Сообщение: Re: SQL subquery to supply table name?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unixtime (epoch) into timestamp?