SELECT mmt.inventory_item_id as item_id
, y.organization_id as org_id
, mmt.subinventory_code as subinv
, sum(mmt.primary_quantity) qty
FROM
apps.mtl_material_transactions mmt,
apps.mtl_system_items msi,
(SELECT distinct mmt.organization_id, mmt.inventory_item_id
FROM apps.mtl_material_transactions mmt,
apps.mtl_system_items msi
WHERE mmt.organization_id = msi.organization_id
AND mmt.inventory_item_id = msi.inventory_item_id
AND msi.segment1 in ('')
AND trunc (mmt.transaction_date) <= TRUNC (:p_date)) y
WHERE
mmt.organization_id = msi.organization_id
AND mmt.inventory_item_id = msi.inventory_item_id
AND mmt.inventory_item_id = y.inventory_item_id
AND mmt.organization_id = y.organization_id
AND mmt.subinventory_code is not null
AND trunc (mmt.transaction_date) <= TRUNC (:p_date)
group by y.organization_id
, mmt.subinventory_code
, mmt.inventory_item_id
, y.organization_id as org_id
, mmt.subinventory_code as subinv
, sum(mmt.primary_quantity) qty
FROM
apps.mtl_material_transactions mmt,
apps.mtl_system_items msi,
(SELECT distinct mmt.organization_id, mmt.inventory_item_id
FROM apps.mtl_material_transactions mmt,
apps.mtl_system_items msi
WHERE mmt.organization_id = msi.organization_id
AND mmt.inventory_item_id = msi.inventory_item_id
AND msi.segment1 in ('')
AND trunc (mmt.transaction_date) <= TRUNC (:p_date)) y
WHERE
mmt.organization_id = msi.organization_id
AND mmt.inventory_item_id = msi.inventory_item_id
AND mmt.inventory_item_id = y.inventory_item_id
AND mmt.organization_id = y.organization_id
AND mmt.subinventory_code is not null
AND trunc (mmt.transaction_date) <= TRUNC (:p_date)
group by y.organization_id
, mmt.subinventory_code
, mmt.inventory_item_id
No comments:
Post a Comment