Reputation: 103
SELECT * FROM `user`
WHERE name !='' AND `date_created` BETWEEN DATE_SUB( CURDATE( ) ,INTERVAL 3 Day )
AND DATE_SUB( CURDATE( ) ,INTERVAL 0 Day )
ORDER BY `date` ASC
The above query brings record 3day before from todays date.
but i need 3day records from today,which means tomorrow , day after tomorrow etc.
date_created is mysql date format.
Upvotes: 0
Views: 6675
Reputation: 109
I have created this will return previous 3 days record
select * from events where DATEOFEVENT IN (select date(curdate()-3 ))
Upvotes: 0
Reputation: 56357
SELECT * FROM `user`
WHERE name !=''
AND `date_created` BETWEEN curdate() and curdate() + interval 3 day
ORDER BY `date`
Upvotes: 6