mysql finds out if the last payment is expired

Solved with the hint of @nbk. In MySQL we can’t use MAX in a where, therefore:

FROM `payments`
where subscription_id = 1 
  and (SELECT MAX(expires_at) 
         FROM payments 
        WHERE subscription_id = 1 AND paid = true) < CURDATE()

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top