Re: join a lot of columns of two tables

From: "Peter Childs" <peterachilds(at)gmail(dot)com>
To:
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: join a lot of columns of two tables
Date: 2006-12-14 11:09:13
Message-ID: a2de01dd0612140309v7422c308k7fd8e74a86898ae9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 14/12/06, ivan marchesini <marchesini(at)unipg(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ragnar 2006-12-14 12:10:59 Re: join a lot of columns of two tables
Previous Message ivan marchesini 2006-12-14 11:01:00 join a lot of columns of two tables