select * from table_name
where (date between DATE_ADD(LAST_DAY(DATE_SUB(CURDATE(), interval 30 day), interval 1 day) AND CURDATE() )
Or better :
select * from table_name
where (date between DATE_FORMAT(NOW() ,'%Y-%m-01') AND NOW() )
More Related Contents:
- Left Outer Join doesn’t return all rows from my left table?
- Get a list of dates between two dates
- How to convert a string to date in MySQL?
- Error in MySQL when setting default value for DATE or DATETIME
- How to get the number of days of difference between two dates on MySQL?
- Converting a date in MySQL from string field
- MySQL: Select All Dates In a Range Even If No Records Present
- MySQL SELECT WHERE datetime matches day (and not necessarily time)
- MySQL Query – Records between Today and Last 30 Days
- Difference between two dates in MySQL
- CURRENT_DATE/CURDATE() not working as default DATE value
- How to select date from datetime column?
- Get the latest date from grouped MySQL data
- How to get an age from a D.O.B field in MySQL?
- mysql: get record count between two date-time
- How to get first day of every corresponding month in mysql?
- Count days between two dates, excluding weekends (MySQL only)
- How to select the most recent set of dated records from a mysql table
- How do I get the first day of the week of a date in mysql?
- MySQL date format
- MySQL: How to select records for this week?
- Compare only day and month with date field in mysql
- MySQL – select data from database between two dates
- How to select only date from a DATETIME field in MySQL?
- Insert/ Update random date in MySQL
- How to compare timestamp dates with date-only parameter in MySQL?
- #1292 – Incorrect date value: ‘0000-00-00’ [duplicate]
- MySQL cumulative sum grouped by date
- SQL date format convert? [dd.mm.yy to YYYY-MM-DD]
- Working with INTERVAL and CURDATE in MySQL