pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: tconti@hotmail.com
To: pgsql-sql@postgresql.org
Subject: Join Statements
Date: 11 Feb 2002 07:15:37 -0800
Message-ID: <5e0d3eda.0202110715.764ff25f@posting.google.com> (raw)

Howdy:

I need to put together an SQL statement that will return all of the
rows in table A that are not in table B.  Table A and B have the same
primary key.  For example:

select count(a.*) 
from a  (nolock) left outer join
b (nolock) on a.id = b.id
where a.id != b.id

This did not work.  It returned 0 rows.  I know that this could be
done very easily in a sub-select, but that seems inefficient.  Is
there any way to accomplish what I mentioned above in the join
statement or is the sub-select the way to go?

Thanks for the help,
Tom



view thread (4+ messages)  latest in thread

Message-ID: <5e0d3eda.0202110715.764ff25f@posting.google.com>
Permalink:  ../5e0d3eda.0202110715.764ff25f@posting.google.com/
Also on:    postgresql.org/message-id/5e0d3eda.0202110715.764ff25f@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tconti@hotmail.com
  Subject: Re: Join Statements
  In-Reply-To: <5e0d3eda.0202110715.764ff25f@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox