Thread: JOIN columns with no data

JOIN columns with no data

From
"Keith Worthington"
Date:
Hi All,

I am trying to create a fairly large join (7 tables) that needs to allow NULL
in columns.

Table 1
1 | A | 2
2 | B | 3

JOINed with

Table 2
1 | note

should output
1 | A | 2 | note
2 | B | 3 |

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com


Re: JOIN columns with no data

From
George Weaver
Date:
Keith,

The following should give you what you're looking for

SELECT  Table1.col1, Table1.col2, Table1.col3, Table2.col2
FROM Table1
LEFT JOIN Table2
WHERE Table1.col1 = Table2.col1;

etc.

George

----- Original Message -----
From: "Keith Worthington" <keithw@narrowpathinc.com>
To: "PostgreSQL Novice" <pgsql-novice@postgresql.org>
Sent: Tuesday, December 21, 2004 3:13 PM
Subject: [NOVICE] JOIN columns with no data


> Hi All,
>
> I am trying to create a fairly large join (7 tables) that needs to allow
> NULL
> in columns.
>
> Table 1
> 1 | A | 2
> 2 | B | 3
>
> JOINed with
>
> Table 2
> 1 | note
>
> should output
> 1 | A | 2 | note
> 2 | B | 3 |
>
> Kind Regards,
> Keith
>
> ______________________________________________
> 99main Internet Services http://www.99main.com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>