2

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

2
  • Can you more clearify your question Commented May 7, 2012 at 9:52
  • Kindly try the following answer. Commented May 7, 2012 at 10:04

1 Answer 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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.