[RESOLVED]twitter-style follower/following Count -sql query

Lets say I have a table like this

follow_id(PK)       User_ID    UserID(FK)

15 8 3
16 4 3
17 6 3
18 3 8
19 4 8
     

If the Current User is Logged in, the UserID table becomes active, how do I write my sql query to give me a count of users am following and a count of users following me..

E,g The UserID (3) is Following 3 people and He’s been followed by 1 person (User_ID)

The UserID (8) is Following 2 people and He’s been followed by 1 person (User_ID)

Solved

Leave a Reply