I'm having issues writing a MySQL query. It's actually a pretty large one, and the part I'm having issues with is about this User_City table :
| user_id | int(11)
| city_id | int(11)
| from | date
| to | date
I would like to compare the ID of the city in which the user we're looking for currently lives, with the ID provided by the user performing the research. I have something like this :
User_City.user_id=User.id and User_City.city_id='.$city_id.' and...
Now the problem is writing the last part where I specify that I want to compare the ID of the most recent entry, meaning the line in which the from field has the highest value but the user_id is still the same.