`
netbusxp
  • 浏览: 9927 次
  • 性别: Icon_minigender_1
  • 来自: 成都
最近访客 更多访客>>
社区版块
存档分类
最新评论

sns好友算法(2)——共同好友

阅读更多
算了 一起更新吧 今天早晨起来啥也没干 就写了2篇博客
还是根据上次的 表就不复制了
如果查询用户1,2之间的共同好友 也就是像人人那样查看
1->X->2这种关系 由于好友表只是一度关系 查询两度遍历下就行了
select friend_id from xxx where user_id=1 and friend_id in(select friend_id from xxx where user_id=2)

这就是查1,2的共同好友了 不扯了 完了。。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics