From: | "Stephan Szabo" <sszabo(at)kick(dot)com> |
---|---|
To: | "Zot O'Connor" <zot(at)zotconsulting(dot)com> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Finding entries not in table..differnce? |
Date: | 2000-07-11 00:43:10 |
Message-ID: | 01fc01bfead0$fcdd1e30$0c64010a@kick.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)zotconsulting(dot)com>
To: "postgres sql" <pgsql-sql(at)hub(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Erol Oz | 2000-07-11 00:50:33 | Re: Finding entries not in table..differnce? |
Previous Message | Zot O'Connor | 2000-07-11 00:29:47 | Finding entries not in table..differnce? |