Re: Finding missing records

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Finding missing records
Дата
Msg-id 20060127092307.X26847@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Finding missing records  ("Stefano B." <stefano.bonnin@comai.to>)
Список pgsql-general
On Fri, 27 Jan 2006, Stefano B. wrote:

> 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)

Is there a reason you've used f1-f4 in the table2 subselect rather than
g1-g4? From the definitions above, I think the f1-f4 in the subselect are
becoming outer references which isn't what you want.

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

Предыдущее
От: "Ron St-Pierre"
Дата:
Сообщение: Importing Many XML Records
Следующее
От: Harald Armin Massa
Дата:
Сообщение: Re: TSearch2 / German compound words / UTF-8