Skip to content
Advertisement

MySQL select complete last month

How to select all data from last month (or 30 days)?

I already found some answers, and mostly gives this solution

But this gives me also the dates from the future

I am only interested in the days from last month or 30 days (not next month and beyond)

Advertisement

Answer

Is this what you want?

I added a condition so the query filters on date not greater than today. I also modified your code so the date range starts one month ago (you had 3 months).

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement