jingo
jingo

Reputation: 1074

Get specific date range

I'm using

SELECT * from tbl_name WHERE DATE_SUB(CURRENT_DATE(), INTERVAL 3 DAY)

to select data 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 ?

Upvotes: 0

Views: 117

Answers (1)

alinoz
alinoz

Reputation: 2822

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()

Upvotes: 2

Related Questions