0
你好,我有MySQL查詢一樣,它的正常工作,但我想以檢查條件現在branches.visible = 1,則也顯示在查詢MySQL查詢與緯度經度和多個搜索加入
SELECT
company.name,
company.id,
company.mobile,
company.telephone,
IFNULL(fav.status, 'no') AS 'favorite',branchInfo.logo,
((((acos(sin(($lat*pi()/180)) * sin((branches.lat*pi()/180))+cos(($lat*pi()/180)) * cos((branches.lat*pi()/180)) * cos((($lng- branches.lng)*pi()/180))))*180/pi())*60*1.1515*1.609344)) AS 'distance',
branchInfo.telephone,
branchInfo.id,
branchInfo.name,
branches.buffet,
branches.halal,
branches.kidsPlayArea,
branches.liveBand,
branches.outdoor,
branches.sheesha,
branches.valetParking,
branches.petsAllowed,
branches.wiFi,
branches.sportEvents,
branches.reservationRequired,
branches.wheelChairAccess,
branches.acceptCreditCard,
branches.brunch,
branchInfo.name,
branches.street,
branches.city,
branches.area,
branches.lat,
branches.lng,
branches.id,
branches.visible
FROM branches
LEFT JOIN users branchInfo
ON branchInfo.id=branches.branchId
LEFT JOIN users company
ON company.id=branches.companyId
LEFT JOIN favorite_branches fav
ON fav.branchId=branches.branchId AND fav.userId=$uId
HAVING distance < 25
你傷了我的眼睛( – mcklayin
爲什麼我打破了你的眼睛兄弟 –
格式化你的代碼是可讀的東西,在發佈前考慮我已經編輯您的文章,以使代碼可讀。您是否嘗試添加where子句? –