I’m working on a “Possible Friends” feature. where i need to show all the friends of friends who’s not my friend and also not send me or not having my pending request
FRIENDSHIPS
user_id
friend_id
status (0 = pending, 1 = approved)
For each friendship I make two records. Say users 1 and 2 become friends… I would make a record where user_id=1,friend_id=2 and another where user_id=2, friend_id=1 in the friendships table.
when first user send request, set status to 0 and when friend accept request then I would update both row with 1
How would I make a sql query that suggests “possible friends” based on friends of my friends ?
Here you go… simple join