Re: [GENERAL] Finding missing records

2006-01-27 Thread Stephan Szabo
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 1 records > table2 has 9900 records (these re

Re: [GENERAL] Finding missing records

2006-01-27 Thread John D. Burger
I wrote: Note that IN and EXCEPT are essentially set operators - if you have duplicates in either table, you might not get what you expect. If what you want is the =bag= difference of the two tables, you'll have to do something more complicated. and then I immediately saw Pandurangan's mess

Re: [GENERAL] Finding missing records

2006-01-27 Thread John D. Burger
On Jan 27, 2006, at 08:59, Stefano B. wrote: 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 1 table1 records. The standard way to do this i

Re: [GENERAL] Finding missing records

2006-01-27 Thread Pandurangan R S
select f1,f2,f3,f4 from table1 EXCEPT ALL select f1,f2,f3,f4 from table2 http://www.postgresql.org/docs/8.1/static/sql-select.html On 1/27/06, Stefano B. <[EMAIL PROTECTED]> wrote: > > Hi, > > I have two identical tables > > table1 (f1,f2,f3,f4 primary key (f1,f2,f3,f4)) > > table2 (g1,g2,g3,g4 p

Re: [GENERAL] Finding missing records

2006-01-27 Thread A. Kretschmer
am 27.01.2006, um 14:59:47 +0100 mailte Stefano B. folgendes: > How can I find the difference between the two tables? > table1 has 1 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,

[GENERAL] Finding missing records

2006-01-27 Thread Stefano B.
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 1 records table2 has  9900 records (these records are in table1 as well)   I'd like to fin