Q:

MySQL Select rows from last month however it contains(31/30/28 days) or leap year

Now, I have a mysql query to get the rows from last month where date is the  timestamp column like,
date BETWEEN date_format(NOW() - INTERVAL 1 MONTH, '%Y-%m-01')
AND last_day(NOW() - INTERVAL 1 MONTH);

But the problem is, I am getting only the records of 30 days of the last month.  Its working fine for the months with 30 days or lower.  But for the months like December I need all the records of 31 days.  What will be the correction here?  Thanks.  

A:

I have tried many references & at last I have got my exact answer.  My final code is, 
EXTRACT(YEAR_MONTH FROM date) = EXTRACT(YEAR_MONTH FROM CURDATE() - INTERVAL 1 MONTH)

Thanks everyone.