select
NVL(TR_QTY, 0) - (
NVL(TR_QTY_B, 0) + NVL(TR_QTY_C, 0)
) res_qty
from
(
SELECT
(
SELECT
SUM(transaction_quantity)
FROM
INV_ONHAND_QUANTITIES_DETAIL
WHERE
inventory_item_id = 100000000615408
AND organization_id = 300000002138348
AND subinventory_code IN (
SELECT
SECONDARY_INVENTORY_NAME
FROM
INV_SECONDARY_INVENTORIES
WHERE
organization_id = 300000002138348
AND reservable_type = '2'
)
) AS TR_QTY_C,
(
SELECT
SUM(RESERVATION_QUANTITY)
FROM
INV_RESERVATIONS
WHERE
inventory_item_id = 100000000615408
AND organization_id = 300000002138348
) AS TR_QTY_B,
(
SELECT
SUM(transaction_quantity)
FROM
INV_ONHAND_QUANTITIES_DETAIL
WHERE
inventory_item_id = 100000000615408
AND organization_id = 300000002138348
) AS TR_QTY
from
egp_system_items_b MB1
where
1 = 1
AND (
mb1.organization_id = 300000002138348
)
AND (
mb1.inventory_item_id = 100000000615408
)
);
0 comments:
Post a Comment