1. 当日
select 字段 from 表名 where 时间字段 BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');
2. 昨天
SELECT * FROM `day_sell` WHERE TO_DAYS(NOW()) - TO_DAYS(sell_time) <= 1
3. 近七天
SELECT * FROM `day_sell` WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) < DATE(sell_time);
SELECT * FROM day_sell WHERE YEARWEEK(DATE_FORMAT(sell_time,'%Y-%m-%d')) = YEARWEEK(NOW());
#上周的数据
SELECT * FROM day_sell WHERE YEARWEEK(DATE_FORMAT(sell_time,'%Y-%m-%d')) = YEARWEEK(NOW()) -1;