Re: SQL subquery to supply table name?

Поиск
Список
Период
Сортировка
Искать
От
Martijn van Oosterhout
Тема
Re: SQL subquery to supply table name?
Дата
Msg-id
20020926234607.GA16768@svana.org
Ответ на
Список
Дерево обсуждения
Re: SQL subquery to supply table name? Joe Conway <mail@joeconway.com>
On Thu, Sep 26, 2002 at 04:04:14PM -0700, Scott Chapman wrote:
> I have a situation where a table contains table names.  I need to know if I 
> can make a Postgresql query that will have a subquery which supplies the 
> table name I want to deal with.  Can this be done?
> 
> Something like this:
> select column from (select table_name from table2 where key=value) where 
> key=value;

The answer is no. You may be able to fudge it by creating a plpgsql function
that builds the query on the fly but it will probably suck performance-wise.

Sounds like your database structure is not properly normalised.
-- 
Martijn van Oosterhout      http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.
В списке pgsql-general по дате отправления
От: Doug McNaught
Дата:
От: Scott Chapman
Дата:
FAQ