Re: Create a new table from records not joined in a left outer join - Mailing list pgsql-novice

From Jayadevan M
Subject Re: Create a new table from records not joined in a left outer join
Date
Msg-id 3411BBAFF5A2244FA405CC91D9473A609B4F95@PBOX2.ibsplc.com
Whole thread Raw
In response to Create a new table from records not joined in a left outer join  (Sindile Bidla <sindile.bidla@gmail.com>)
List 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 = 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."

pgsql-novice by date:

Previous
From: Sindile Bidla
Date:
Subject: Create a new table from records not joined in a left outer join
Next
From: Matthew Foster
Date:
Subject: Question about join