Monday, May 14, 2012

MySQL query for a recommendation engine

I am making a food recommendation engine.
I have two tables:




  1. Places that contain rating, cuisine, price, name etc.

  2. checkin that contain place_name, rating, userid, count etc.



Now for recommendation I need to check the previous checkin of the user and made recommendation accordingly. So my query is like



select *,factor1+factor2+factor3 as final_rating
from places
order by final_rating desc


factor1 and factor2 are working great but not factor3.



Factor 3 is I want to check the cuisines in which user has checkined most. So for a place in place table I have to check its cuisine and then look into the checkin table for the count of checkins made by a user for that particular cuisine.



NOTE: There is no cuisine column in checkin table.





No comments:

Post a Comment