Hello everyone I hope you can help me on this
I have a table m_membership_list
and there are fields date_from
and date_to
and I need to count the number of the records where current date is between date_to
and the last_30 days of the the date_to
.
I searched about this but I did not find the exact example but I think the logic is like in MySQL Query - Records between Today and Last 30 Days
But still I can't get it.
Here is my SQL.
SELECT * FROM m_membership_list WHERE NOW() IN DATE_SUB(date_to, INTERVAL 30 DAY)
I think the logic is almost like this but i dont know why it is not working.
SELECT * FROM m_membership_list WHERE NOW() BETWEEN date_to AND (DATE_SUB(date_to,INTERVAL 30 DAY))
Improv