I'm not entirely sure if MySQL supports these (I assume so, but not 
positive).  Try these two queries instead:

To find similar:

(SELECT * FROM ddetails)
INTERSECT CORRESPONDING BY name
(SELECT * FROM ddata)

Find differences:

(SELECT * FROM ddetails)
EXCEPT CORRESPONDING BY name
(SELECT * FROM ddata)

-Chris

At 02:51 AM 4/25/02 +0100, Donna Robinson wrote:
>Hi,
>I am going nuts!
>I am querying two databases which are very similar to find the differences
>between various tables.
>
>These two tables are 15 rows and 14 rows respectively.
>Why does this work (finds all similar rows):
>select ddetails.name, ddata.name
>from dancedetails.coupletypes as ddetails, dancedata.couples as ddata
>where ddetails.name = ddata.name;
>
>+------------+------------+
>| name       | name       |
>+------------+------------+
>| 1 couple   | 1 couple   |
>| 2 couples  | 2 couples  |
>| 3 couples  | 3 couples  |
>...
>+------------+------------+
>14 rows in set (0.00 sec)
>
>BUT not this (trying to find the different rows):
>select ddetails.name, ddata.name
>from dancedetails.coupletypes as ddetails, dancedata2.couples as ddata
>where ddetails.name != ddata.name;
>+------------+------------+
>| name       | name       |
>+------------+------------+
>| 2 couples  | 1 couple   |
>| 3 couples  | 1 couple   |
>| 4 couples  | 1 couple   |
>| 5 couples  | 1 couple   |
>| 6 couples  | 1 couple   |
>...
>| 3 facing 3 | other      |
>|            | other      |
>+------------+------------+
>196 rows in set (0.12 sec)
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to