The database has a table called accounts - where all users are stored and there is a followers table - where subscribers' id numbers are stored. It is necessary to select all the subscribers of a certain user.

CREATE TABLE accounts ( id int PRIMARY KEY , about nvarchar(MAX) , name nvarchar(MAX) -- ... ); CREATE TABLE followers ( id int PRIMARY KEY , folower_id int , following_id int -- ... ); 

Accounts

Followers

1 answer 1

It is possible so:

 SELECT f.name FROM followers INNER JOIN accounts AS f ON f.id = followers.follower_id INNER JOIN accounts AS f_ing ON f_ing.id = followers.following_id WHERE f_ing.name = 'COMEDY CLAB'; 

SQLFiddle