728x90
반응형

📌 하루

SELECT * 
FROM TABLE_NAME 
WHERE DATE_COLUMN BETWEEN DATE_ADD(NOW(),INTERVAL -1 DAY) AND NOW();

 

📌 일주일

SELECT * 
FROM TABLE_NAME 
WHERE DATE_COLUMN BETWEEN DATE_ADD(NOW(),INTERVAL -1 WEEK) AND NOW();

 

📌 한 달

SELECT * 
FROM TABLE_NAME 
WHERE DATE_COLUMN BETWEEN DATE_ADD(NOW(),INTERVAL -1 MONTH) AND NOW();
반응형
복사했습니다!