Reputation: 331
I have a query which is running perfectly last day answered by Shaikh Farooque Link of that question
Now I have another problem I need to filter those foodjoint_id detail which are under the same cuisine_id. User going to submit lat long and cuisine_id I need to filter those FoodJoint
As I told you I already search Food Joint by the Lat Long which is running now I need to add cuisine filter.
The query which is running is
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
and I have added it with :
SELECT foodjoint_id FROM menu_item WHERE cuisine_id=''.$userGivenCuisineId.''
I am sorry to say that the problem is still unsolved
Upvotes: 2
Views: 85
Reputation: 2630
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
Upvotes: 1