Re: Finding entries not in table..differnce?

From: Erol Oz <eroloz(at)bilgi(dot)edu(dot)tr>
To: "Zot O'Connor" <zot(at)zotconsulting(dot)com>
Cc: postgres sql <pgsql-sql(at)hub(dot)org>
Subject: Re: Finding entries not in table..differnce?
Date: 2000-07-11 00:50:33
Message-ID: 396A6F59.6132C357@bilgi.edu.tr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rob S. 2000-07-11 05:26:38 Creating timestamps in queries?
Previous Message Stephan Szabo 2000-07-11 00:43:10 Re: Finding entries not in table..differnce?