Re: compare 2 tables in sql
От | Dean Gibson (DB Administrator) |
---|---|
Тема | Re: compare 2 tables in sql |
Дата | |
Msg-id | 47E18CFF.2020408@ultimeth.com обсуждение исходный текст |
Ответ на | compare 2 tables in sql ("Tena Sakai" <tsakai@gallo.ucsf.edu>) |
Список | pgsql-sql |
On 2008-03-19 10:56, Tena Sakai wrote: <blockquote cite="mid:FE44E0D7EAD2ED4BB2165071DB8E328C0378F138@egcrc-ex01.egcrc.org"type="cite"></blockquote><p><font size="2">Hi Everybody,<br/><br /> Is there a sql way to compare (in a diff/cmp sense) 2 tables? For example,<br /><br /> create tablefoo as<br /> [select bla bla bla];<br /><br /> create table moo as<br /> [select bla bla bla];<br /><br /> Howwould I go about knowing foo and moo are identical (or not)? Any pointer would be appreciated.<br /><br /> Tena<br /></font> You could do a full outer join of "foo" and "moo" on whatever is the common key, and then delete those rows whichdon't have null fields in the either the left or right sides; the remainder would be the differences.<br /><pre class="moz-signature"cols="72">-- Mail to my list address MUST be sent via the mailing list. All other mail to my list address will bounce.</pre>
В списке pgsql-sql по дате отправления: