Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. SELECT count(s.subscription_id) AS count
  2. FROM subscriptions s JOIN wallets w USING (business_id)
  3. WHERE
  4. w.entry_id IS NOT NULL
  5. AND w.last_four IS NOT NULL
  6. AND s.annual = TRUE
  7. AND s.auto_renew = TRUE
  8. AND s.state = 'ACTIVE'
  9. AND date_add(s.start_date, INTERVAL 1 YEAR) = current_date;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement