Friend of a friend in PHP/MySQL?

前端 未结 5 1277
醉话见心
醉话见心 2020-12-04 20:52

I have a social network similar to myspace/facebook. In my code you are either a person\'s friend or not a friend, so I show all actions from people you are friends with (in

5条回答
  •  独厮守ぢ
    2020-12-04 21:15

    you do a subquery:

    SELECT DISTINCT user_id FROM friends WHERE friend_id IN (SELECT user_id FROM friends WHERE friend_id = 1)

提交回复
热议问题