[MySQL] 하루, 일주일, 한 달 데이터 가져오기
2021. 8. 20. 20:38
프로그래밍/SQL
📌 하루 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();