joining tables

From: TedJones <ted(at)mentra(dot)co(dot)uk>
To: pgadmin-support(at)postgresql(dot)org
Subject: joining tables
Date: 2019-09-02 17:24:37
Message-ID: 1567445077110-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

I'm having problems joining 3 tables to provide a 4th table in the correct
format. I believe I need a FULL OUTER JOIN but does not give the result that
I require.See below:

Example 1
Table: Names Table: Friend
Name Tel email PostCode Name friend email
Jim 1 aa I Dave yes cc
Ted 2 bb J Will yes dd
Dave 3 cc K Zac yes ff
Will 4 dd L Byron yes gg

Table: Details
Name email Town PostCode
John ee A M
Zac ff B N
Byron gg C O
Will dd D L
Gary hh E P
Ted bb F J

Combined table: Result
Name Tel email Town PostCode friend
Jim 1 aa I
Ted 2 bb F J
Dave 3 cc K yes
Will 4 dd D L yes
John ee A M
Zac ff B N yes
Byron gg C O yes
Gary hh E P

Example 2
Table: Names Table: Friend
Name Tel email PostCode Name friend email
Jim 1 aa I Gareth yes ii
Ted 2 bb J Tony yes jj
Dave 3 cc K Ken yes kk
Will 4 dd L Lloyd yes ll

Table: Details
Name email Town PostCode
John ee A M
Zac ff B N
Byron gg C O
Gary hh E P

Combined table: Result
Name Tel email Town PostCode friend
Jim 1 aa I
Ted 2 bb J
Dave 3 cc K
Will 4 dd L
John ee A M
Zac ff B N
Byron gg C O
Gary hh E P
Gareth ii yes
Tony jj yes
Ken kk yes
Lloyd ll yes

--
Sent from: https://www.postgresql-archive.org/PostgreSQL-pgadmin-support-f2191615.html

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Patrick Headley 2019-09-03 03:14:46 Re: joining tables
Previous Message Ariel Giomi 2019-09-02 12:25:06 Re: Thegeshwar