标签:mat from color for code sum style font pre
-- 24小时
SELECT HOUR (create_date) AS hours, SUM(source_amount) sm_source_amount, SUM(ticket_count*purchase_price) AS sm_purchase_amount FROM ticket_order WHERE DATE_FORMAT(create_date, ‘%Y-%m-%d‘) = ‘2017-05-12‘ AND scenic_id in(1,2,3); GROUP BY HOUR (create_date); select hour(create_date) as hours,ticket_count,create_date from ticket_order where DATE_FORMAT(create_date,‘%Y-%m-%d‘) = ‘2017-05-12‘ group by hour(create_date); -- 天 SELECT SUM(source_amount) AS sm_source_amount, SUM(ticket_count) AS sm_ticket_count FROM ticket_order WHERE DATE_FORMAT(create_date, ‘%Y-%m-%d‘) = ‘2017-05-17‘; -- 月 SELECT SUM(source_amount) AS sm_source_amount, SUM(ticket_count) AS sm_ticket_count FROM ticket_order WHERE DATE_FORMAT(create_date, ‘%Y-%m‘) = ‘2017-05‘; -- 所有 SELECT SUM(source_amount) AS sm_source_amount, SUM(ticket_count) AS sm_ticket_count FROM ticket_order;
标签:mat from color for code sum style font pre
原文地址:http://www.cnblogs.com/flydkPocketMagic/p/7200206.html