Skip site navigation (1) Skip section navigation (2)

combining tables

From: "G(dot) J(dot) Walsh" <gjwalsh(at)dscdirectionalservices(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: combining tables
Date: 2008-10-26 01:02:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I have a situation now where I have a group of 4 tables within one
database. All tables make use of the code defined in the first column as
the primary key.

1 of the 4 tables has the complete range of keys, in this case about
1,000. The other 3 tables have data representing most but not all of
those keys, and in different sets. I want to end up with a new
'combined' table which will allow me to immediately 'see' missing data
from the 3 smaller tables and take the necessary steps to 'fill in the
blanks'. I realize I would of course have to create that table without
constrictions other than the primary key.

My <<< shaky >>> understanding from the manual is that I could use
something like:

SELECT * FROM tmain,tsub1,tsub2,tsub3 NATURAL INNER JOIN tcombo

Am I on the right track? 

Thanks for any heads up you'd be kind enough to provide.



pgsql-novice by date

Next:From: Cliff NieuwenhuisDate: 2008-10-26 04:59:28
Subject: Re: combining tables
Previous:From: Oliveiros CristinaDate: 2008-10-24 12:05:44
Subject: Re: [INSERT]Insert blank values

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group