简体   繁体   English

如何从数据库获取关注者列表和关注者

[英]How to get a list of followers and following from database

Im OK with databases but this structure stumps me a bit. 我可以使用数据库,但是这种结构让我有些困惑。 It's from Michael Hartls tutorial 来自Michael Hartls的教程 在此处输入图片说明

I am trying to get a json file that will list all the followers and the people they are following in json format so that ['nodes'] consists of user names and ['links'] consist of the id of firstly the following and also the follower 我正在尝试获取一个json文件,该文件将以json格式列出所有关注者及其关注的人,以便['nodes']由用户名组成, ['links']由以下各项的ID组成,以及追随者

The problem is that i have no idea how to execute a query on a table that consists of both the follower and the follwing to get this result when they are both from the same table. 问题是我不知道如何在由跟随者和跟随者组成的表上执行查询,以使它们都来自同一表时获得此结果。

Join once on the followingId and once on the followerId and that will treat it as two "tables" for you in the set. 一次在followingId上加入,一次在followerId上加入,这对于您在集合中将其视为两个“表”。 You can join tona single table as much as you want. 您可以根据需要加入tona单张桌子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM