"某料號" 在 "某期間內" 的 "SO 訂單數量"

在 Oracle ERP 中, 如何取得 ""某料號" 在 "某期間內" 的 "SO 訂單數量"",

語法, 如下 :
 語法
SELECT NVL(SUM(OOL.ORDERED_QUANTITY), 0)  ORDERED_QTY
FROM OE_ORDER_HEADERS_ALL OOH
, OE_ORDER_LINES_ALL OOL
WHERE OOH.HEADER_ID = OOL.HEADER_ID
AND OOH.ORG_ID = &ORG_ID
AND OOL.INVENTORY_ITEM_ID = &INVENTORY_ITEM_ID
AND OOH.ORDERED_DATE BETWEEN TO_DATE('&START_DATE','YYYYMMDD') and (TO_DATE('&END_DATE','YYYYMMDD')+ 1)
AND OOL.LINE_CATEGORY_CODE = 'ORDER'
AND OOL.FLOW_STATUS_CODE <> 'CANCELLED'
AND OOL.ORDERED_QUANTITY > 0;
Related Posts Plugin for WordPress, Blogger...