抓某OU下各廠各月的接單和開工單的張數
抓某OU下各廠各月的接單和開工單的張數[@more@]create table sp01 asselect oo.ORGANIZATION_CODE,oo.NAME, to_char(ol.actual_shipment_date,'yyyymm') ship_month, count(*) total, sum(decode(sign(ol.shipped_quantity-100),1,0,1)) qty1t100, sum(decode(sign(ol.shipped_quantity-101),-1,0, decode(sign(ol.shipped_quantity-500),1,0,1) ) ) qty101t500, sum(decode(sign(ol.shipped_quantity-501),-1,0, decode(sign(ol.shipped_quantity-1000),1,0,1) )