2

我有一个查询,昨天运行得很好,由 Shaikh Farooque Link 回答了那个问题

现在我有另一个问题,我需要过滤那些在同一个美食 ID 下的 foodjoint_id 细节。 用户要提交 lat long 和 food_id 我需要过滤那些 FoodJoint

正如我告诉你的那样,我已经通过正在运行的 Lat Long 搜索 Food Joint,我需要添加美食过滤器。

正在运行的查询是

SELECT foodjoint_id,foodjoint_name,open_hours,cont_no,address_line,city, 
( 3959 * acos( cos( radians('".$userLatitude."') ) * 
   cos( radians( foodjoint_latitude) ) * cos( radians( foodjoint_longitude) - 
   radians('".$userLongitude."') ) + sin( radians('".$userLatitude."') ) * 
   sin( radians( foodjoint_latitude) ) ) ) AS distance,
 (SELECT AVG(customer_ratings) 
 FROM customer_review 
 WHERE foodjoint_id=provider_food_joints.foodjoint_id) AS customer_rating 
 FROM provider_food_joints 
 HAVING distance < '3' ORDER BY distance

我已经添加了它:

SELECT foodjoint_id FROM menu_item WHERE cuisine_id=''.$userGivenCuisineId.''

很遗憾的说问题还是没有解决

4

1 回答 1

1
SELECT foodjoint_id,foodjoint_name,open_hours,cont_no,address_line,city, 
( 3959 * acos( cos( radians('".$userLatitude."') ) * 
   cos( radians( foodjoint_latitude) ) * cos( radians( foodjoint_longitude) - 
   radians('".$userLongitude."') ) + sin( radians('".$userLatitude."') ) * 
   sin( radians( foodjoint_latitude) ) ) ) AS distance,
(select AVG(customer_ratings) from customer_review where 
foodjoint_id=provider_food_joints.foodjoint_id) as customer_rating 
FROM provider_food_joints 
where  foodjoint_id in 
(SELECT foodjoint_id FROM menu_item WHERE cuisine_id='".$userGivenCuisineId."')
HAVING distance < '3' ORDER BY distance
于 2012-05-07T09:59:47.593 回答