1.Q:给一个日期范围,统计每天入库的数据总量
A:建表stock,范围假定除去2020-06-03
SELECT DATE_FORMAT( a.addtime, '%Y-%m-%d' ) , count(id)
FROM
(SELECT id , addtime FROM stock WHERE stock.addtime between '2020-05-30' AND '2020-06-03') a
GROUP BY DATE_FORMAT( a.addtime, '%Y-%m-%d' )