I have a MySQL table, in which I will be storing the email_id of a user along with the user’s followers’ email_ids. Its columns are:
ID, USER_EMAIL, FOLLWING_EMAIL
Now while the user is logged in to his account, I want to calculate:
- The number of people he is following
- The number of followers he has
Calculating the number of people he’s following is simple:
select count(*) from list where user_email = <logged-in email>
But how can I calculate how many people are following him in just one query?
1 Answer