Re: [SQL] comparing 2 tables. . .
От | Eric BASIER |
---|---|
Тема | Re: [SQL] comparing 2 tables. . . |
Дата | |
Msg-id | 37EB8B5F.23F9CA40@ipgp.jussieu.fr обсуждение исходный текст |
Ответ на | comparing 2 tables. . . (JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>) |
Список | pgsql-sql |
Hello, You can try this, (but i think it may take a long time ) 1 : Find which tuples are in t1 and not in t2select distinctt1.pk from t1 where t1.pk not in (select t2.pk from t2); 2 : Find which tuples are in t2 and not in t1selectdistinct t2.pk from t2 where t2.pk not in (select t1.pk from t1);In the case that you only want to known the references If you want to rebuilt your table after analyze you can make this : select distinct t1.pk into t1b from t1 where t1.pknot in (select t2.pk from t2); select distinct t2.pk into t2b from t2 where t2.pk not in (select t1.pk from t1); After your analyze you can insert tuples of table t1b into table t1 and tuples of table t2b into table t2. Regards -- Basier Eric e-mail : basier@ipgp.jussieu.fr http://geoscope.ipgp.jussieu.fr IPGP Observatoires Sismologie-Volcanologie 4,Place Jussieu 75005 Paris Tour 24-14 4eme Etage Tel 01 44 27 38 96
В списке pgsql-sql по дате отправления: