I am trying to a search that returns results from a certain radius. I have the first step working but its when I try to expand the results by including the second table that it stops working. I don't think UNION is the way to go but Ieft that in to better explaing what I am trying to do:
SELECT *, 3956 * 2 * ASIN(SQRT( POWER(SIN((48.4284207 -abs(dest.lat)) * pi()/180 / 2),2) + COS(48.4284207 * pi()/180 ) * COS( abs(dest.lat) * pi()/180) * POWER(SIN((-123.3656444 - dest.lng) * pi()/180 / 2), 2) ))
as distance
FROM business dest having distance < 10500 and
(businessName LIKE '%web%') ORDER BY distance
UNION
(
SELECT b.*
FROM business b, keywords k
WHERE k.keyword
LIKE '%web%' and b.businessID=k.businessID
)
The second table had two columns a "keyword" and then a fk to the businessID from the first table.