My two tables, with only the relevant values included, are:
- xx_users (user_id, name, location)
- xx_posts (post, user_id)
xx_users contains all users, including the current user and the poster.
In mock code, what I am trying to achieve is:
SELECT * FROM xx_posts WHERE poster location = user location
Given the crossover between the two tables, how would I approach this?
If I well understood your question, the solution can be something like :
SELECT * from posts INNER JOIN users ON users.user_id = posts.user_id WHERE users.location = 'the location‘