Lists: | pgsql-general |
---|
From: | o(dot)blomqvist(at)secomintl(dot)com (Otto Blomqvist) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | making two tables with identical schemas appear as one |
Date: | 2004-08-16 16:17:32 |
Message-ID: | c501cb7d.0408160817.1fb11979@posting.google.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Hello !
I have a couple of tables with the same schema that I would like to
query and view as one table. I looked into CREATE VIEW and FULL JOINs
but still can't figure out a good (fast) way of doing this..
Any ideas ?
/Otto Blomqvist
From: | Holger Klawitter <lists(at)klawitter(dot)de> |
---|---|
To: | o(dot)blomqvist(at)secomintl(dot)com (Otto Blomqvist), pgsql-general(at)postgresql(dot)org |
Subject: | Re: making two tables with identical schemas appear as one |
Date: | 2004-08-20 07:06:44 |
Message-ID: | 200408200906.48681.lists@klawitter.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
> I have a couple of tables with the same schema that I would like to
> query and view as one table. I looked into CREATE VIEW and FULL JOINs
> but still can't figure out a good (fast) way of doing this..
It depends on the specific way you want to bring the tables together.
Without more specific information nobody will be able to help.
Somehow I suspect you are looking for UNION:
CREATE VIEW
bothTables
AS SELECT
x, y, z
FROM tableA
UNION SELECT
x, y, z
FROM tableB
;
Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFBJaMI1Xdt0HKSwgYRAkjQAJ95RawVA5ufaIaY1bITFHAvYsZWwACcCA0c
QKqsbAC1an/JIl/4Ok5mqLU=
=045v
-----END PGP SIGNATURE-----
From: | John Sidney-Woollett <johnsw(at)wardbrook(dot)com> |
---|---|
To: | Otto Blomqvist <o(dot)blomqvist(at)secomintl(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: making two tables with identical schemas appear as |
Date: | 2004-08-20 09:40:43 |
Message-ID: | 4125C71B.2040002@wardbrook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
Do you mean
create view MyView as
select * from table1
union
select * from table2;
John Sidney-Woollett
Otto Blomqvist wrote:
> Hello !
>
> I have a couple of tables with the same schema that I would like to
> query and view as one table. I looked into CREATE VIEW and FULL JOINs
> but still can't figure out a good (fast) way of doing this..
>
> Any ideas ?
>
> /Otto Blomqvist
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> |
---|---|
To: | John Sidney-Woollett <johnsw(at)wardbrook(dot)com> |
Cc: | Otto Blomqvist <o(dot)blomqvist(at)secomintl(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: making two tables with identical schemas appear as |
Date: | 2004-08-20 14:08:20 |
Message-ID: | 20040820140820.GA5280@dcc.uchile.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Fri, Aug 20, 2004 at 10:40:43AM +0100, John Sidney-Woollett wrote:
> Do you mean
>
> create view MyView as
> select * from table1
> union
> select * from table2;
Be sure to understand the difference between UNION and UNION ALL if you
are going to do this ...
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"No reniegues de lo que alguna vez creíste"