SELECT DISTINCT
mmt1.transaction_id,
mmt1.transaction_date,
mcacd1.transaction_costed_date,
mmt2.transaction_id,
mmt2.transaction_date,
mcacd2.transaction_costed_date,
mmt1.inventory_item_id,
mmt1.cost_group_id
FROM org_acct_periods oap,
mtl_material_transactions mmt1,
mtl_material_transactions mmt2,
mtl_cst_actual_cost_details mcacd1,
mtl_cst_actual_cost_details mcacd2
WHERE oap.acct_period_id = &acct_period_id
AND mmt1.transaction_date
BETWEEN oap.period_start_date
AND oap.schedule_close_date
AND mmt1.inventory_item_id = mmt2.inventory_item_id
AND mmt1.cost_group_id = mmt2.cost_group_id
AND mmt1.transaction_date < mmt2.transaction_date
AND mcacd1.transaction_id = mmt1.transaction_id
AND mcacd2.transaction_id = mmt2.transaction_id
AND mcacd1.transaction_costed_date >
mcacd2.transaction_costed_date
mmt1.transaction_id,
mmt1.transaction_date,
mcacd1.transaction_costed_date,
mmt2.transaction_id,
mmt2.transaction_date,
mcacd2.transaction_costed_date,
mmt1.inventory_item_id,
mmt1.cost_group_id
FROM org_acct_periods oap,
mtl_material_transactions mmt1,
mtl_material_transactions mmt2,
mtl_cst_actual_cost_details mcacd1,
mtl_cst_actual_cost_details mcacd2
WHERE oap.acct_period_id = &acct_period_id
AND mmt1.transaction_date
BETWEEN oap.period_start_date
AND oap.schedule_close_date
AND mmt1.inventory_item_id = mmt2.inventory_item_id
AND mmt1.cost_group_id = mmt2.cost_group_id
AND mmt1.transaction_date < mmt2.transaction_date
AND mcacd1.transaction_id = mmt1.transaction_id
AND mcacd2.transaction_id = mmt2.transaction_id
AND mcacd1.transaction_costed_date >
mcacd2.transaction_costed_date
No comments:
Post a Comment