pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedjoin a lot of columns of two tables
3+ messages / 3 participants
[nested] [flat]
* join a lot of columns of two tables
@ 2006-12-14 11:01 ivan marchesini <marchesini@unipg.it>
2006-12-14 11:09 ` Re: join a lot of columns of two tables Peter Childs <peterachilds@gmail.com>
2006-12-14 12:10 ` Re: join a lot of columns of two tables Ragnar <gnari@hive.is>
0 siblings, 2 replies; 3+ messages in thread
From: ivan marchesini @ 2006-12-14 11:01 UTC (permalink / raw)
To: pgsql-sql
Dear Postgres Users,
I have 2 tables...
each one has a column called ID (primary keys of each table)
the values into each ID column are exactly the same.
each table has a lot of other columns (around 50 for each table)....
I would like to create a table containing the ID (only one column
obviously) and all the other columns of both tables...
a simple equi join for each column is simple but how can I join
completely the two table on the bases of the column ID???
probably it is a simple question but I don't know how to solve this very
simple problem quikly... :-(
thanks
Ivan
--
Ti prego di cercare di non inviarmi files .doc, .xls, .ppt, .dwg.
Preferisco formati liberi.
Please try to avoid to send me .doc, .xls, .ppt, .dwg files.
I prefer free formats.
http://it.wikipedia.org/wiki/Formato_aperto
http://en.wikipedia.org/wiki/Open_format
Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a
06125
Perugia (Italy)
e-mail: marchesini@unipg.it
ivan.marchesini@gmail.com
tel: +39(0)755853760
fax: +39(0)755853756
jabber: geoivan73@jabber.org
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: join a lot of columns of two tables
2006-12-14 11:01 join a lot of columns of two tables ivan marchesini <marchesini@unipg.it>
@ 2006-12-14 11:09 ` Peter Childs <peterachilds@gmail.com>
1 sibling, 0 replies; 3+ messages in thread
From: Peter Childs @ 2006-12-14 11:09 UTC (permalink / raw)
To: ; +Cc: pgsql-sql
On 14/12/06, ivan marchesini <marchesini@unipg.it> wrote:
> Dear Postgres Users,
> I have 2 tables...
> each one has a column called ID (primary keys of each table)
> the values into each ID column are exactly the same.
>
> each table has a lot of other columns (around 50 for each table)....
>
> I would like to create a table containing the ID (only one column
> obviously) and all the other columns of both tables...
>
> a simple equi join for each column is simple but how can I join
> completely the two table on the bases of the column ID???
>
> probably it is a simple question but I don't know how to solve this very
> simple problem quikly... :-(
> thanks
>
> Ivan
>
select * from t1 full join t2 on (t1.id=t2.id);
you'll end up with the id column from both tables if you don't want
that you are going to need to list all the column names.
Peter.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: join a lot of columns of two tables
2006-12-14 11:01 join a lot of columns of two tables ivan marchesini <marchesini@unipg.it>
@ 2006-12-14 12:10 ` Ragnar <gnari@hive.is>
1 sibling, 0 replies; 3+ messages in thread
From: Ragnar @ 2006-12-14 12:10 UTC (permalink / raw)
To: marchesini@unipg.it; +Cc: pgsql-sql
On fim, 2006-12-14 at 12:01 +0100, ivan marchesini wrote:
> Dear Postgres Users,
> I have 2 tables...
> each one has a column called ID (primary keys of each table)
> the values into each ID column are exactly the same.
>
> each table has a lot of other columns (around 50 for each table)....
>
> I would like to create a table containing the ID (only one column
> obviously) and all the other columns of both tables...
>
> a simple equi join for each column is simple but how can I join
> completely the two table on the bases of the column ID???
>
> probably it is a simple question but I don't know how to solve this very
> simple problem quikly... :-(
> thanks
select * from t1 join t2 USING (id);
gnari
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-12-14 12:10 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-12-14 11:01 join a lot of columns of two tables ivan marchesini <marchesini@unipg.it>
2006-12-14 11:09 ` Peter Childs <peterachilds@gmail.com>
2006-12-14 12:10 ` Ragnar <gnari@hive.is>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox