/* Formatted on 10/1/2011 12:54:05 PM (QP5 v5.115.810.9015) */
SELECT COUNT ( * ) RECEIPT_NUM,
RECEIPT_NUM,
rsh.SHIPMENT_NUM,
rsl.LINE_NUM,
rsl.ITEM_ID,
rt.TRANSACTION_TYPE,
rt.QUANTITY,
ood.ORGANIZATION_NAME,
ood.ORGANIZATION_CODE,
ood.OPERATING_UNIT
FROM rcv_shipment_headers rsh,
rcv_shipment_lines rsl,
rcv_transactions rt,
org_organization_definitions ood
WHERE rsh.SHIPMENT_HEADER_ID = rsl.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_LINE_ID = rt.SHIPMENT_LINE_ID
AND ood.organization_id = rsl.TO_ORGANIZATION_ID
AND rt.TRANSACTION_TYPE = 'DELIVER'
AND TRUNC (rt.transaction_date) BETWEEN '01-APR-2011'
AND '13-Aug-2011'
GROUP BY RECEIPT_NUM,
rsh.SHIPMENT_NUM,
rsl.LINE_NUM,
rsl.ITEM_ID,
rt.TRANSACTION_TYPE,
rt.QUANTITY,
ood.ORGANIZATION_NAME,
ood.ORGANIZATION_CODE,
ood.OPERATING_UNIT
HAVING COUNT (RECEIPT_NUM) > 1
ORDER BY rsh.RECEIPT_NUM
SELECT COUNT ( * ) RECEIPT_NUM,
RECEIPT_NUM,
rsh.SHIPMENT_NUM,
rsl.LINE_NUM,
rsl.ITEM_ID,
rt.TRANSACTION_TYPE,
rt.QUANTITY,
ood.ORGANIZATION_NAME,
ood.ORGANIZATION_CODE,
ood.OPERATING_UNIT
FROM rcv_shipment_headers rsh,
rcv_shipment_lines rsl,
rcv_transactions rt,
org_organization_definitions ood
WHERE rsh.SHIPMENT_HEADER_ID = rsl.SHIPMENT_HEADER_ID
AND rsl.SHIPMENT_LINE_ID = rt.SHIPMENT_LINE_ID
AND ood.organization_id = rsl.TO_ORGANIZATION_ID
AND rt.TRANSACTION_TYPE = 'DELIVER'
AND TRUNC (rt.transaction_date) BETWEEN '01-APR-2011'
AND '13-Aug-2011'
GROUP BY RECEIPT_NUM,
rsh.SHIPMENT_NUM,
rsl.LINE_NUM,
rsl.ITEM_ID,
rt.TRANSACTION_TYPE,
rt.QUANTITY,
ood.ORGANIZATION_NAME,
ood.ORGANIZATION_CODE,
ood.OPERATING_UNIT
HAVING COUNT (RECEIPT_NUM) > 1
ORDER BY rsh.RECEIPT_NUM
No comments:
Post a Comment