SELECT od.date,od.orderCount
FROM (
SELECT DATE_FORMAT (order_time, '%Y-%m-%d') date,
count(*) orderCount FROM order WHERE order_time > '开始时间' andorder_time < '结束时间' GROUPBYDATE_FORMAT (order_time, '%Y-%m-%d')
UNION (SELECT0, '2017-03-01')
UNION (SELECT0, '2017-03-02')
UNION (SELECT0, '2017-03-03')
UNION (SELECT0, '2017-03-04') -- 很多个UNION......
) AS od GROUPBY od.date ORDERBY od.date ASC
网友评论