pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFinding entries not in table..differnce?
3+ messages / 3 participants
[nested] [flat]
* Finding entries not in table..differnce?
@ 2000-07-11 00:29 Zot O'Connor <zot@zotconsulting.com>
2000-07-11 00:43 ` Re: Finding entries not in table..differnce? Stephan Szabo <sszabo@kick.com>
2000-07-11 00:50 ` Re: Finding entries not in table..differnce? Erol Oz <eroloz@bilgi.edu.tr>
0 siblings, 2 replies; 3+ messages in thread
From: Zot O'Connor @ 2000-07-11 00:29 UTC (permalink / raw)
To: postgres sql <pgsql-sql@hub.org>
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.
--
Zot O'Connor
http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Finding entries not in table..differnce?
2000-07-11 00:29 Finding entries not in table..differnce? Zot O'Connor <zot@zotconsulting.com>
@ 2000-07-11 00:43 ` Stephan Szabo <sszabo@kick.com>
1 sibling, 0 replies; 3+ messages in thread
From: Stephan Szabo @ 2000-07-11 00:43 UTC (permalink / raw)
To: Zot O'Connor <zot@zotconsulting.com>; +Cc: 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@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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Finding entries not in table..differnce?
2000-07-11 00:29 Finding entries not in table..differnce? Zot O'Connor <zot@zotconsulting.com>
@ 2000-07-11 00:50 ` Erol Oz <eroloz@bilgi.edu.tr>
1 sibling, 0 replies; 3+ messages in thread
From: Erol Oz @ 2000-07-11 00:50 UTC (permalink / raw)
To: Zot O'Connor <zot@zotconsulting.com>; +Cc: postgres sql <pgsql-sql@hub.org>
If I understand you exactly, you may use except:
select distinct * from prodlang
except
select distinct * from prodlang2
gives you the records which exist in prodlang and do not exist in
prodlang2. So you get all the records in prodlang which are newly
inserted or updated.
regards
erol
Zot O'Connor wrote:
>
> 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.
>
> --
> Zot O'Connor
>
> http://www.ZotConsulting.com
> http://www.WhiteKnightHackers.com
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2000-07-11 00:50 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-11 00:29 Finding entries not in table..differnce? Zot O'Connor <zot@zotconsulting.com>
2000-07-11 00:43 ` Stephan Szabo <sszabo@kick.com>
2000-07-11 00:50 ` Erol Oz <eroloz@bilgi.edu.tr>
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