日期:2014-05-17 浏览次数:20971 次
with date_table as (select (sysdate-level) orderdate from dual connect by level < 365), order_table as (select t.orderdate, count(t.ticketid) cnt, sum(t.fare) sumfare, sum(t.fuel_tax) sumfueltax, sum(t.airport_tax) sumairtax, sum(t.paymoney) sumpay from metticket t where t.status = '2' and t.orderdate is not null group by t.orderdate order by t.orderdate) select date_table.orderdate, decode(cnt,null,0,cnt), decode(sumfare,null,0,sumfare), decode(sumfueltax,null,0,sumfueltax), decode(sumairtax,null,0,sumairtax), decode(sumpay,null,0,sumpay) from date_table left join order_table on date_table.orderdate=order_table.orderdate order by 1;