I have an array of dates and I need to find if the user had an active membership during those dates.
['2016-04-17', '2016-04-18', '2016-04-22', '2016-04-23']
Sometimes a membership can't be charged and go inactive for a few days until the next payment is processed, or the user may cancel and reactivate later.
The way I'm solving this is having a transactions
table with a paid_at
column and expires_at
(expiring date set after 1 month of paid).
I would need to perform a where
clause to return me the dates that match between those two columns in all the records in the database. I don't need the record itself, just returning the date means should be enough to know it was a day while the membership was active.
Im having a hard time understanding how such a query could be made. Any suggestion?