郑先森灬
世上没有偶然,有的只是必然,正面面对困难,才能迈向成功。
统计每年的订单量
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;
EYblog - Powered by Eyblog
https://akxdz.com/index.php/archives/90/(转载时请注明本文出处及文章链接)