Mysql query to get data last or next days



MySQL Query to select data from last week?


PREVIOUS DAYS


SELECT * FROM table

WHERE date_field BETWEEN date_sub(now(),INTERVAL 1 WEEK) and now();




NEXT DAYS(TOMORROW OR +++)


SELECT * FROM table

WHERE date_filed BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 7 DAY);



SELECT * FROM table

WHERE date_filed  >= NOW() AND Product_exp_date <= NOW() + INTERVAL 7 DAY;

Comments

Popular posts from this blog

Android App Version Update using the following cordova cli commands

75 inspirational quotes that will change your life

Retrieval Image From DataBase and Display on WebPage by Using Servlets.