Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 01:40 AM
Otto Blomqvist
Guest
 
Posts: n/a
Default making two tables with identical schemas appear as one

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
  #2  
Old November 23rd, 2005, 01:43 AM
Holger Klawitter
Guest
 
Posts: n/a
Default Re: making two tables with identical schemas appear as one

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
[color=blue]
> 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..[/color]

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)

iD8DBQFBJaMI1Xdt0HKSwgYRAkjQAJ95RawVA5ufaIaY1bITFH AvYsZWwACcCA0c
QKqsbAC1an/JIl/4Ok5mqLU=
=045v
-----END PGP SIGNATURE-----


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

  #3  
Old November 23rd, 2005, 01:44 AM
John Sidney-Woollett
Guest
 
Posts: n/a
Default Re: making two tables with identical schemas appear as

Do you mean

create view MyView as
select * from table1
union
select * from table2;

John Sidney-Woollett

Otto Blomqvist wrote:
[color=blue]
> 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[/color]

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

  #4  
Old November 23rd, 2005, 01:44 AM
Alvaro Herrera
Guest
 
Posts: n/a
Default Re: making two tables with identical schemas appear as

On Fri, Aug 20, 2004 at 10:40:43AM +0100, John Sidney-Woollett wrote:[color=blue]
> Do you mean
>
> create view MyView as
> select * from table1
> union
> select * from table2;[/color]

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"


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles