I’m very new to joins, so far I’ve been doing relatively simple joins but this one got me stumped.
I have 2 tables that look like this:
Friends Table
friendship_id | friend_init | friend_accept | status
1 | 18 | 10 | 1
2 | 13 | 18 | 0
Users Table
user_id | email | username | password | kittens, etc...
10 | -- | -- | -- | --
13 | -- | -- | -- | --
18 | -- | -- | -- | --
If I am trying to select all the info about user_id 18’s friends from both tables where the friends record status = 1, what would the join look like?
Drop the
UNION...if your database is symmetrical (you have both(18,10)and10,18), or if you only want to see friendships from one side.