Finding missing records

Поиск
Список
Период
Сортировка
От Stefano B.
Тема Finding missing records
Дата
Msg-id 004801c62349$eebf5860$0501a8c0@comai04
обсуждение исходный текст
Ответы Re: Finding missing records  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: Finding missing records  (Pandurangan R S <pandurangan.r.s@gmail.com>)
Re: Finding missing records  ("John D. Burger" <john@mitre.org>)
Re: Finding missing records  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
Hi,
 
I have two identical tables
 
table1 (f1,f2,f3,f4 primary key (f1,f2,f3,f4))
table2 (g1,g2,g3,g4 primary key (g1,g2,g3,g4))
 
How can I find the difference between the two tables?
table1 has 10000 records
table2 has  9900 records (these records are in table1 as well)
 
I'd like to find 100 missing records.
I have try this query
 
select f1,f2,f3,f4 from table1 where (f1,f2,f3,f4) NOT IN (select f1,f2,f3,f4 from table2)
 
but it seems not work (as I want). It returns me no records. If I use the IN clause it returns me all 10000 table1 records.
 
Thanks in advance
Stefano

В списке pgsql-general по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Accessing an old database from a new OS installation.
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Finding missing records