If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Trying to find what's not in second table.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-23-06, 04:27
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,259
Im not sure you can do what you want in one pass, you may need to do two queries and then filter out any cities which have been matched against state names (and found missing) and vice versa

this should get you somewhere near wear you want
"SELECT City_Merge.City, City_Merge.State
FROM City_Merge LEFT JOIN Categories ON City_Merge.City = Categories.Name
WHERE Categories.Name Is Null;"

..it was created in MS Access
so to get the other match try

"SELECT City_Merge.City, City_Merge.State
FROM City_Merge LEFT JOIN Categories ON City_Merge.State = Categories.Name
WHERE Categories.Name Is Null;"
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #2 (permalink)  
Old 11-23-06, 04:36
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,259
Im not sure you can do what you want in one pass, you may need to do two queries and then filter out any cities which have been matched against state names (and found missing) and vice versa

this should get you somewhere near wear you want
"SELECT City_Merge.City, City_Merge.State
FROM City_Merge LEFT JOIN Categories ON City_Merge.City = Categories.Name
WHERE Categories.Name Is Null;"

you will need to extend this to check the states match... should be able to do that using a sub select.. that way round you will filter out say cities in different states with the same name

Mind you, I think you physical desin is a bit suspect.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On