MySQL Query to select data from last week?
PREVIOUS DAYS
SELECT * FROM tableWHERE date_field BETWEEN date_sub(now(),INTERVAL 1 WEEK) and now();
NEXT DAYS(TOMORROW OR +++)
SELECT * FROM tableWHERE 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;
No comments:
Post a Comment