SELECT
oi.category_id1,
oi.category_id2,
oi.category_id3,
DATE_FORMAT(o.`pay_time`, '%Y-%m-%d') count_date,
SUM(oi.num) num,
SUM(oi.pay_money) money
FROM
tb_order_item oi,
tb_order o
WHERE oi.`order_id` = o.`id`
AND o.`pay_status` = '1'
AND DATE_FORMAT(o.`pay_time`, '%Y-%m-%d') = '2019-01-26'
GROUP BY
oi.`category_id1`,
oi.`category_id2`,
oi.`category_id3`,
DATE_FORMAT(o.`pay_time`, '%Y-%m-%d');
|
|