inserting columns with values from a different table

Поиск
Список
Период
Сортировка
От Alexander Turchin
Тема inserting columns with values from a different table
Дата
Msg-id 3B48EB7D.71FD1B56@chip.org
обсуждение исходный текст
Ответы Re: inserting columns with values from a different table  (Frank Miles <fpm@u.washington.edu>)
Re: inserting columns with values from a different table  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
Hello all,

This may be (hopefully) a very basic question, but I (admittedly, a
pgsql newbie) cannot seem to be able to find an answer to it :(

I have in my database tables, say A, B, and C, all of them referring to
the same objects (e.g. table A contains customer's name, table B his/her
purchases, and table C his/her address). I want to create a "master"
table D whose rows would have some values from table A, some from B, and
some from C (e.g. name, last purchase, and address). I know I can do an
INSERT with SELECT - but that will only allow me to insert values from
one table, not from all three (or more). Is there any way to do this in
PostgreSQL?

I do realize that I could likely imitate everything I need from a master
table by having many different tables and executing [more or less]
complicated queries, but having a "master" table would greatly simplify
my life and avoid multiple potential mistakes when constructing those
queries...

Thanks!

Alex


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

Предыдущее
От: missive@frontiernet.net (Lee Harr)
Дата:
Сообщение: Re: Postgres and C/C++
Следующее
От: "Gregory Wood"
Дата:
Сообщение: Re: inserting columns with values from a different table