Re: select union with table name

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: select union with table name
Дата
Msg-id 473133.66672.qm@web31810.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на select union with table name  (Akbar <akbarhome@gmail.com>)
Список pgsql-general
> I want this:
> name    table_name
> 'blabla'   blue
> 'bubu'    blue
> 'haha'    red
> 'kkk'      red
>
> Could I?

Here is an example from the table inheritance chapter:

SELECT p.relname, c.name, c.altitude
FROM cities c, pg_class p
WHERE c.altitude > 500 and c.tableoid = p.oid;

which returns:

 relname  |   name    | altitude
----------+-----------+----------
 cities   | Las Vegas |     2174
 cities   | Mariposa  |     1953
 capitals | Madison   |      845

http://www.postgresql.org/docs/8.2/interactive/ddl-inherit.html

it should do what you want.

Regards,

Richard Broersma Jr.

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

Предыдущее
От: "Joris Dobbelsteen"
Дата:
Сообщение: Re: select union with table name
Следующее
От: Ron Johnson
Дата:
Сообщение: Re: Re: [GENERAL] ??: [GENERA