Skip to content
Advertisement

How to get the number of new subscriptions and the number of subscription renewals in SQL?

Having this table representing users subscriptions:

There can be multiple records with the same email.

How can I get the number of new subscriptions per month and the number of subscription renewals per month?

Let’s say a subscription was made with email “aaa@a.com” in July 2018. If another subscription is made in August 2018 with “aaa@a.com”, it’s a renewal. All subscriptions that was made in August 2018 where the email is not registered in July 2018 are new subscriptions.

Advertisement

Answer

You can do this by determining the first time a subscriber is seen:

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