Back to problems

Exclude free subscribers via anti-join

SQL · Intuit · Medium

Given a subscriptions fact table, a small month calendar, and a list of companies that have ever received a free subscription, write a single SQL query that produces a monthly new-subscriber report with year-over-year comparisons. For each company_id, treat its first paid subscription as the row with the minimum start_date in Subscriptions. The calendar month containing that minimum date is the company's acquisition month, and the company is counted only in that month.…

Checking your access…