SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(ss.shop_name,'市',-1),'市',1) AS '店铺名称1', FROM_UNIXTIME(st.pay_time,'%Y-%m-%d') AS '日期1', COUNT(st.tid) AS '订单总数1' , SUM(st.total_fee+st.post_fee) AS '订单总金额1',
FROM_UNIXTIME(st.pay_time,'%Y-%m') AS '月份', FROM_UNIXTIME(st.pay_time,'%Y') AS '年份', sum( st.smalldeposit)as'电子购物卡1',sum(st.u_voucher)as'返利余额1' ,sum(st.payment )as '实付金额1' FROM systrade_trade st LEFT JOIN sysshop_shop ss ON st.shop_id=ss.shop_id WHERE ss.shop_name LIKE '%联盛超市%' AND FROM_UNIXTIME(st.pay_time,'%Y-%m-%d') >= '2018-12-06' AND 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 != '测试' GROUP BY ss.shop_name, FROM_UNIXTIME(st.pay_time,'%Y-%m-%d') 我想用店铺名称来做查询条件的,大屏展示的,目前这样是按照店铺名称,按照日期来的,我想要按照店铺来查询,这样方便每天比较下 |
最佳回答 |
||||
1
|
|