select p1.name,
p1.place_id,
p1.latitude,
p1.longitude,
sqrt(pow(69.1*(p1.latitude-52.20),2)+ pow(53*(abs(p1.longitude-0.13)),2)) as dist from places p1,subcategory s, placehascategory phc where p1.county_id=
and p1.name != "Cambridge" and s.name="Inland Revenue"
and phc.place_id=p1.place_id
and phc.subcat_id=s.subcat_id order by dist limit 10
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and p1.name != "Cambridge" and s.name="Inland Revenue"
and phc.' at line 6 Error