Saturday, 24 August 2013

MySQL Comparasion of two databases and tables and get results

MySQL Comparasion of two databases and tables and get results

I Have Two Databases (DTB1 and DTB2). I would like to show only results
from DTB1 that is not equal in DTB2.I know which field i need to compare
and that is Field MOUSES.
Example:
DTB1 DTB2
CLICKS 0 1
MOUSES 1 1
HOUSES 2 1
CARS 3 1
Result the output result is CLICKS, HOUSES and CARS (because MOUSES have
both equal values).
i try this...but my sql cpu is 94% when i try this query:
SELECT a.mouses FROM $database.$table a WHERE NOT EXISTS (SELECT b.mouses
FROM $database2.$table2 b WHERE b.mouses=a.mouses);
Any Help Welcome.

No comments:

Post a Comment