Get specific date range
I'm using
SELECT * from tbl_name WHERE DATE_SUB(CURRENT_DATE(), INTERVAL 3 DAY)
to select d开发者_如何学Pythonata for specific days. The problem is that line gets data right before 3 days. What to do so selected data to be period three days before till now ?
First your field should be of type datetime
or date
and then you can use a between
clause
your_date_field BETWEEN now() - INTERVAL 72 HOURS AND now()
精彩评论