Re: How do I create a new table based on combining a number of tables

Поиск
Список
Период
Сортировка
От Intengu Technologies
Тема Re: How do I create a new table based on combining a number of tables
Дата
Msg-id a1afa64b0909280300i5e84a392p827f9d8a63bd3ed4@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How do I create a new table based on combining a number of tables  (Serge Fonville <serge.fonville@gmail.com>)
Список pgsql-novice
Thanks Serge

Here is my attempt of an sql statement, but only the first table is
being inserted.

As a nice to have would also to add a field to indicate from which table.

1. create table allfrm_1

2. insert the records of the other tables into allfrm_1

INSERT INTO deeds.allfrm_1

SELECT * FROM  deeds.plssblmfrm_1
UNION ALL

SELECT * FROM  deeds.plssctnfrm_1
UNION ALL

SELECT * FROM  deeds.plssjhbfrm_1
UNION ALL

SELECT * FROM  deeds.plsskimfrm_1
UNION ALL

SELECT * FROM  deeds.plsskwtfrm_1
UNION ALL

SELECT * FROM  deeds.plsspmbfrm_1
UNION ALL

SELECT * FROM  deeds.plssptafrm_1
UNION ALL

SELECT * FROM  deeds.plssutafrm_1
UNION ALL

SELECT * FROM  deeds.plssvryfrm_1
;

2009/9/28 Serge Fonville <serge.fonville@gmail.com>:
> Hi,
> Both can do the job
> Use a union
> http://www.postgresql.org/docs/8.4/interactive/queries-union.html.
> HTH
> Regards,
> Serge Fonville
>
> On Mon, Sep 28, 2009 at 9:59 AM, Intengu Technologies
> <sindile.bidla@gmail.com> wrote:
>>
>> Hi List
>>
>> I have a number of tables that I would want to combine (append one
>> table to another) into a single table. What would be the best approach
>> and how do I write the corresponding sql statement:
>>
>> 1. Create a new table
>>
>> 2. Create a view
>>
>> --
>> Sindile Bidla
>>
>> --
>> Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-novice
>
>
>
> --
> Convince Google!!
> They need to support Adsense over SSL
> https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=10528
> http://www.google.com/support/forum/p/AdSense/thread?tid=1884bc9310d9f923&hl=en
>



--
Sindile Bidla

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

Предыдущее
От: Serge Fonville
Дата:
Сообщение: Re: How do I create a new table based on combining a number of tables
Следующее
От: Mary Anderson
Дата:
Сообщение: Connect to database with php pg_connect, cannot find table even though it shows up on psql connection