mysql - filter column based on date range -


i need filter column containing time , date date range. want see values have been recorded month present day.(from 2016-06-21 2016-07-21) date format in column yyyy-mm-dd hh:mm:ss of data in column looks this:

2016-07-01 13:38:04 2016-07-01 12:52:41 2016-07-01 12:52:41 2015-05-30 13:04:42 2015-05-30 13:04:42 2016-06-29 10:23:39 2016-06-29 10:23:39 2016-06-29 09:49:43 2015-05-29 09:49:20 2015-05-28 15:05:11 2016-05-28 15:04:46 2016-06-28 15:00:43 2016-05-30 11:33:42 2016-05-30 11:30:53 2015-05-02 09:54:34 

you can do:

select t.* t col >= date_sub(curdate(), interval 1 month); 

this should work whether column stored string or datetime, because format readily converted datetime. however, should use native types dates , times, rathe strings.


Comments