Finding active days for a subscription/user/account (date spining)

Great post!

I believe the end_date condition should allow for NULLs to support records that are the most recent:

    left join util_days
        on product_subscription_periods.start_date <= util_days.date_day
        and (
                product_subscription_periods.end_date > util_days.date_day 
                or product_subscription_periods.end_date is null
        )
2 Likes