select union with table name

Поиск
Список
Период
Сортировка
От Akbar
Тема select union with table name
Дата
Msg-id 5e8843f90612280409t7cd2695eg65a1ddf6d7b552fd@mail.gmail.com
обсуждение исходный текст
Ответы Re: select union with table name  (Richard Broersma Jr <rabroersma@yahoo.com>)
Re: select union with table name  (Reece Hart <reece@harts.net>)
Список pgsql-general
Hi, I have two tables.
create table blue (
  id serial primary key,
  name text not null,
  kill text not null
);

create table red (
  id serial primary key,
  name text not null,
  kiss text not null
);

select blue.name from blue union select red.name from red; give me this:
name
'blabla'
'bubu'
'haha'
'kkk'

I want this:
name    table_name
'blabla'   blue
'bubu'    blue
'haha'    red
'kkk'      red

Could I?

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

Предыдущее
От: Akbar
Дата:
Сообщение: unique constraint on more than one tables
Следующее
От: "Joris Dobbelsteen"
Дата:
Сообщение: Re: select union with table name