I have a table called barcode_log, and these are all the datas from the table.
And now if I run this query
SELECT * FROM `barcode_log` WHERE barcode_log.assign_time BETWEEN DATE_SUB(CURRENT_DATE, INTERVAL 30 DAY) AND CURRENT_DATE;
I get this result
But it should return all the rows as all the data is within this month only. And assign_time field is stored as datetime. Any idea what i am doing wrong??


BETWEENinclusive? Because this might work tomorrow. You are comparing dates, not times.barcode_log.assign_timemight work:WHERE DATE(barcode_log.assign_time) BETWEEN ...