select ${type} as '类型',订单总数1 as '订单总数',sum(订单总金额1) as'订单总金额'from(SELECT count(st.tid)as '订单总数1',sum(st.total_fee+ st.post_fee)as '订单总金额1',FROM_UNIXTIME(st.pay_time,'%m')as'月份',FROM_UNIXTIME(st.pay_time,'%Y')as '年份',FROM_UNIXTIME(st.pay_time,'%Y-%m-%d')as'日期'from systrade_trade st where st.`status` in ('WAIT_SELLER_SEND_GOODS','WAIT_BUYER_CONFIRM_GOODS','TRADE_FINISHED','TRADE_CLOSED') and st.tid in (select tid from systrade_order where title not like '%测试%' ) and st.receiver_name!='测试' and st.shop_id in (1,26,326,716,746,768)and FROM_UNIXTIME(st.pay_time,'%Y') in('2018','2019')group by FROM_UNIXTIME(st.pay_time,'%m'),FROM_UNIXTIME(st.pay_time,'%Y'),FROM_UNIXTIME(st.pay_time,'%Y-%m-%d'))agroup by ${type}这么写,按照日期出来的是对的,按照月份的订单数不对,统计的是每月的第一天的,如果只用月份排序的吗,按月就是对的,按日期就是不对的,感觉就是count导致的,不知道怎么解决,求大神指导下,谢谢!