Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Performing antijoin in postgres



"Suresh_" <suiyengar(at)yahoo(dot)com> writes:

> I want to add an antijoin operator to PostgreSql.  

I think you can already do what you want like this:

SELECT *
  FROM A FULL OUTER JOIN B ON (x=y)
 WHERE x IS NULL
    OR y IS NULL

So for example:

postgres=# select * from a;
 i 
---
 1
 2
(2 rows)

postgres=# select * from b;
 i 
---
 2
 3
(2 rows)

postgres=# select * from a full outer join b on (a.i=b.i) where a.i is null or b.i is null;
 i | i 
---+---
 1 |  
   | 3
(2 rows)

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group