Advertisement
theitd

WPW Renewals

Feb 19th, 2018
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.28 KB | None | 0 0
  1. SELECT COUNT(sub.user_id) AS renewals, plan.title
  2. FROM xiszt_payplans_subscription sub
  3. LEFT JOIN xiszt_payplans_plan plan ON plan.plan_id = sub.plan_id
  4. WHERE sub.expiration_date > DATE_ADD(sub.subscription_date, INTERVAL 1 YEAR)
  5. AND sub.expiration_date > NOW()
  6. GROUP BY sub.plan_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement