Thank you for your help. I've modified the Query a little bit, but still having some issues. It now retreives the second result, but it's also retreiving all results where the masterID is set. I'm not sure how to filter out the ones I don't need. The query also took about 20 sec. which isn't very fast. None of the joins seem to work for me except inner join, maybe that's the problem?
Either that, or maybe I need to join with the menuitems.listingID too?
SELECT listings.*, menuitems.menuName, menuitems.menuDescription
,(((acos(sin((-123.450461*pi()/180)) * sin((listinglat*pi()/180))+cos((-123.450461*pi()/180)) * cos((listinglat*pi()/180)) * cos(((48.579731- listinglong)*pi()/180))))*180/pi())*60*1.1515*1.609344) as distance
,((1.3*(MATCH (listingName) AGAINST ('(bubby) ("bubby") (+bubby)' IN BOOLEAN MODE))) + (0.6*(MATCH (listingDescription,listingAddress1,listingAddress2,listingPostalCode,listingCity,listingProvince,listingPhone,listingFax,listingEmail,listingWebsite,listingLocation,menuName,menuDescription) AGAINST ('(bubby) ("bubby") (+bubby)' IN BOOLEAN MODE)))) AS relevance
FROM listings inner join menuitems
WHERE (MATCH (listingName,listingDescription,listingAddress1,listingAddress2,listingPostalCode,listingCity,listingProvince,listingPhone,listingFax,listingEmail,listingWebsite,listingLocation,menuName,menuDescription) AGAINST ('(bubby) ("bubby") (+bubby)' IN BOOLEAN MODE))
AND menuitems.listingID = listings.listingID
OR menuitems.listingID = listings.masterID
AND listings.listingActive = 0
GROUP BY listingID
ORDER BY relevance DESC
Here are the results, it shouldn't be showing Villages Pizza or Smitty's:
listingID masterID listingName menuName
197 197 Bubby Rose's Bakery Challah
198 197 Bubby Rose's Bakery Challah
14 14 Villages Pizza VILLAGES SPECIAL
35 14 Villages Pizza VILLAGES SPECIAL
47 47 Smitty's Eggs Benedict
93 47 Smitty's Eggs Benedict