SELECT to_char(t.accdate,'mm-dd') 日期, (case when to_char(t.accdate,'yyyy')='2019' then '本期' else '同期' end) 本同期, sum(netsum)/10000 销售金额, count(distinct t.saleno)/10000 客流 FROM t_sale_h t,yxt_dw_busi@dwh2 a where t.busno=a.busno and a.compid_new='2' and ((t.accdate >= trunc(sysdate-7) and t.accdate < trunc(sysdate)) or (t.accdate >= trunc(sysdate-372) and t.accdate < trunc(sysdate-365))) group by to_char(t.accdate,'mm-dd'),(case when to_char(t.accdate,'yyyy')='2019' then '本期' else '同期' end) order by to_char(t.accdate,'mm-dd')