Skip to content
Advertisement

Make SELECT subquery COUNT the total subscribers of a subscriber

I trying to create a query that counts the total subscribers of a subscriber. It currently looks like this:

The FROM CLAUSE AKA all_users_subbed_to is WORKING correctly and displays a ALL the subscribers the current user has. The data comes back as this:

The issue I am having is getting the total subscriber counts for the list of those subscribers. I need to use the subscribers publisher_id ie all_users_subbed_to.publisher_id and get their total subs (using COUNT) from the subscribers table. I would like to create a new column called have subscribers_sub_count that contains that total. Any ideas? It should look like this:

The subscribers table looks like this: enter image description here

Advertisement

Answer

Fixed it. It just needed a WHERE clause that used data from all_users_subbed_to

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement