sql 语句解析date(create_date): 将日期格式化为 2000-01-01这种格式curdate() :获取当前日期 2020-06-30 等同于 date(now())date_sub(curdate(), interval 7 day): 获取7天前的日期统计每年的订单量SELECT YEAR(create_date) as year,COUNT(1) as count FROM orders GROUP BY year; 统计今年每个月的订单量SELECT MONTH(create_date) as month,COUNT(1) as count FROM orders WHERE YEAR(create_date) = YEAR(NOW()) GROUP BY month ORDER BY month; 统计今年每周的订单量SELECT WEEK(create_date) as week,COUNT(1) as count FROM orders WHERE YEAR(create_date) = YEAR(NOW()) GROUP BY week ORDER BY week; 统计今年每日的订单量select DATE_FORMAT(createtime,'%Y-%m-%d') as days,count(*) count from ibt_shop_order group by days;