嗨,我真的很挣扎让下面的SQL查询工作,我提前道歉,如果ive做了这个捣烂,但即时通讯仍然学习SQL的全部高级领域。另一个MYSQL加入问题
这里是我的代码...
"SELECT *,(((acos(sin((".$latitude."*pi()/180)) *
sin((`latitude`*pi()/180))+cos((".$latitude."*pi()/180)) *
cos((`latitude`*pi()/180)) * cos(((".$longitude."- `longitude`)*pi()/180))))
*180/pi())*60*1.1515) as distance
FROM `locations` l HAVING distance <= '".$distance."' JOIN
(SELECT * users) u
ON (l.id = u.basic_location)
WHERE u.id != A $AND2
ORDER BY distance ASC"
我不断收到以下错误消息......
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
'JOIN (SELECT * users) u ON (l.id = u.basic_location) WHERE u.id' at line 1
我用尽许多这样的组合,但香港专业教育学院成为难倒,并寻找一些帮帮我?
尝试把你的距离相比,在where子句中 – WhiteboardDev