mysql 1 hari yang lalu
select *
from orders
where order_date >= DATE_SUB(NOW(),INTERVAL 1 YEAR);
GutoTrosla
select *
from orders
where order_date >= DATE_SUB(NOW(),INTERVAL 1 YEAR);
select id from tbname
where date between date_sub(now(),INTERVAL 1 WEEK) and now();
SELECT sysdate() - 7; -- 1 week ago 12/01/2021 14:27:27
SELECT date(sysdate() - 7); -- 1 week ago 12/01/2021 00:00:00
SELECT * FROM my_table WHERE my_datecol > date(sysdate() - 7);
DAYOFWEEK();//(1 for Sunday,2 for Monday …… 7 for Saturday )