pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@kick.com>
To: Zot O'Connor <zot@zotconsulting.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Finding entries not in table..differnce?
Date: Mon, 10 Jul 2000 17:43:10 -0700
Message-ID: <01fc01bfead0$fcdd1e30$0c64010a@kick.com> (raw)
References: <396A6A7B.39CC7772@zotconsulting.com>

Assuming that you don't have nulls in prodlang.prodlsku,
this should probably work, although I haven't tried it 
for real.

SELECT prodlang.prodlsku FROM prodlang 
WHERE NOT EXISTS 
(SELECT * FROM prodlang2
 WHERE prodlang2.prodlsku=prodlang.prodlsku);

If you do have nulls, the inner select probably needs
to be something like:
(SELECT * FROM prodlang2
 WHERE prodlang2.prodlsku=prodlang.prodlsku
 or (prodlang2.prodlsku is null and prodlang.prodlsku is null))

----- Original Message ----- 
From: "Zot O'Connor" <zot@zotconsulting.com>
To: "postgres sql" <pgsql-sql@hub.org>
Sent: Monday, July 10, 2000 5:29 PM
Subject: [SQL] Finding entries not in table..differnce?


> I need to write a quick function that tells me all of the entriles in
> table that are not in table2.
> 
> The tables are copies of each other, but 1 has been updated.  I know
> this is easy, but I am running on little sleep :)
> 
> I want to due something like
> 
> select prodlang.prodlsku from prodland,prodlang2 WHERE prodlang.prodlsku
> != prodlang2.prodlsku
> 
> But of course I would get every record, several times since at some
> point the sku does not equal another sku.
> 
> I tried !!= (NOT IN) but it did not like that at all, since sku is a
> char field.
> 
> I am running an older version of postgress on this server, I do not know
> if that is important.





view thread (3+ messages)  latest in thread

Message-ID: <01fc01bfead0$fcdd1e30$0c64010a@kick.com>
Permalink:  ../01fc01bfead0$fcdd1e30$0c64010a@kick.com/
Also on:    postgresql.org/message-id/01fc01bfead0$fcdd1e30$0c64010a@kick.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: sszabo@kick.com, zot@zotconsulting.com
  Subject: Re: Finding entries not in table..differnce?
  In-Reply-To: <01fc01bfead0$fcdd1e30$0c64010a@kick.com>
  References: <396A6A7B.39CC7772@zotconsulting.com> <01fc01bfead0$fcdd1e30$0c64010a@kick.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