Mysql查詢一週內的數據

select * from wap_content where week(created_at) = week(now)  若是你要嚴格要求是某一年的,那能夠這樣  查詢一天:  select * from table where to_days(column_time) = to_days(now());  select * from table where date(column_time) = curdate();  查詢一週:  select * from table where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(column_time);  查詢一個月:  select * from table where DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) <= date(column_time);
相關文章
相關標籤/搜索