I have two tables in my database and I would like to join them.
The purpose is to display all comments (friends and my own) on each article. I have managed to select and display my friends comments but not to join and display my own as well.
Table structures
friends:
id
follower
following
users
id
name
email
Query for friends so far:
SELECT following FROM friends WHERE follower='$follower'
Query for user:
SELECT id FROM users WHERE id='$follower'
Use JOIN clause to join both your tables:
Then you can choose necessary rows that meet specified criteria. For example using WHERE clauses: