Re: Create a new table from records not joined in a left outer join

From: Jayadevan M <jayadevan(dot)maymala(at)ibsplc(dot)com>
To: 'Sindile Bidla' <sindile(dot)bidla(at)gmail(dot)com>, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Create a new table from records not joined in a left outer join
Date: 2012-09-13 05:59:03
Message-ID: 3411BBAFF5A2244FA405CC91D9473A609B4F95@PBOX2.ibsplc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a query of a left outer join

CREATE TABLE table3
AS SELECT d.*, u.*
FROM table1 d
LEFT OUTER JOIN table2 u
ON (d.id<http://d.id> = u.sgno);

What i would like to do within the same query is to be able to create a new table with all the records of table2 that are not joined to table1.

CREATE TABLE table3
AS SELECT d.*, u.*
FROM table2 u
LEFT OUTER JOIN table1 d
ON (d.id = u.sgno)
where d.id IS NULL;

Regards,
Jayadevan

DISCLAIMER: "The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Matthew Foster 2012-09-14 17:02:54 Question about join
Previous Message Sindile Bidla 2012-09-13 05:55:16 Create a new table from records not joined in a left outer join