SELECT COUNT(sub.user_id) AS renewals, plan.title FROM xiszt_payplans_subscription sub LEFT JOIN xiszt_payplans_plan plan ON plan.plan_id = sub.plan_id WHERE sub.expiration_date > DATE_ADD(sub.subscription_date, INTERVAL 1 YEAR) AND sub.expiration_date > NOW() GROUP BY sub.plan_id;
Comments