How do you compare contents of two tables using 2 pk

From: "Kent Anderson" <kenta(at)ezyield(dot)com>
To: "Pgsql-Sql(at)Postgresql(dot) Org" <pgsql-sql(at)postgresql(dot)org>
Subject: How do you compare contents of two tables using 2 pk
Date: 2005-02-24 17:17:48
Message-ID: LPENJIOOLAIJBFKIBDKOEECKMEAD.kenta@ezyield.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have two tables that should contain the same number or records. Both
tables use the same 2 foreign keys as their primary keys.

I did a count on the number of records in both and found one table has 500
records less than the first table so I need to know which records are not in
the second table.

table 1
t1_fk_wm (FK)
t1_fk_hm (FK)
...
...
...

table 2
t2_fk_wm (FK)
t2_fk_hm (FK)
....

Table 2 doesn't have the same number of records as the first table however
it should.

Any suggestions would be appreciated as I am still very much a beginner at
SQL.

Kent Anderson

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2005-02-24 17:28:42 Re: Junk queries with variables?
Previous Message Bricklen Anderson 2005-02-24 17:17:42 Re: Junk queries with variables?