|
|
发表于 2007/8/23 16:30:18
|
显示全部楼层
我們公司进料存报表的SQL:
SELECT MSI.INVENTORY_ITEM_ID,MSI.SEGMENT1,MSI.DESCRIPTION,TRUNC(MMT.TRANSACTION_DATE),MMT.TRANSACTION_ID,MMT.TRANSACTION_QUANTITY
,MT.TRANSACTION_TYPE_NAME,NVL(MMT.SOURCE_CODE,' ') SOURCE_CODE,NVL(MMT.TRANSACTION_SOURCE_NAME,' ') SOURCE_NAME
FROM MTL_SYSTEM_ITEMS MSI,
MTL_MATERIAL_TRANSACTIONS MMT,
MTL_TRANSACTION_TYPES MT
WHERE MMT.INVENTORY_ITEM_ID = MSI.INVENTORY_ITEM_ID
AND MSI.ORGANIZATION_ID = _ORGANIZATION_ID
AND MSI.ORGANIZATION_ID = MMT.ORGANIZATION_ID
AND TRUNC(MMT.TRANSACTION_DATE) >= :P_DATE_FM
AND TRUNC(MMT.TRANSACTION_DATE) <= :P_DATE_TO
--AND MSI.SEGMENT1 = :P_ITEM_NUMBER
and msi.inventory_item_id = :p_item_number
AND MMT.SUBINVENTORY_CODE = :P_SUB_INV
AND MMT.TRANSACTION_TYPE_ID = MT.TRANSACTION_TYPE_ID
ORDER BY MSI.SEGMENT1,MMT.TRANSACTION_ID |
|