theitd icon

WPW Renewals

theitd | PRO | 02/19/18 08:21:37 AM UTC | 0 ⭐ | 694 šŸ‘ļø | Never ā° | []
SQL |

280 B

|

None

|

0 šŸ‘

/

0 šŸ‘Ž

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