Re: Comparing tables
| From: | David Smith | Date: | Mon, 25 Aug 2003 22:54:41 +0000 |
| Subject: | Re: Comparing tables | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30093@lists.php.net to get a copy of this message | ||
<quote who="Ron Allen">
> I would like to compare 2 tables in a database to determine which records
> are different!!! Any clues out there. Thanks in advance!
You didn't say which DBMS you are using. If you're using a DBMS which
supports INTERSECT (not MySQL), and assuming the two tables have the same
column names and types, you can do this:
(SELECT * FROM table1) INTERSECT (SELECT * FROM table2)
For MySQL INTERSECT support, monitor this doc:
http://www.mysql.com/doc/en/TODO_sometime.html
--Dave