This document contains an SQL query that selects the most recent unit cost for an inventory item from the CST_LAYER_COSTS table based on the maximum transaction ID and cost date. It then joins this cost data to the EGP_SYSTEM_ITEMS_B and CST_PERPAVG_COST tables to return average cost information for a specified item number.
This document contains an SQL query that selects the most recent unit cost for an inventory item from the CST_LAYER_COSTS table based on the maximum transaction ID and cost date. It then joins this cost data to the EGP_SYSTEM_ITEMS_B and CST_PERPAVG_COST tables to return average cost information for a specified item number.
This document contains an SQL query that selects the most recent unit cost for an inventory item from the CST_LAYER_COSTS table based on the maximum transaction ID and cost date. It then joins this cost data to the EGP_SYSTEM_ITEMS_B and CST_PERPAVG_COST tables to return average cost information for a specified item number.
where clc.inventory_item_id = Q_ITEM.inventory_item_id and clc.TRANSACTION_COST_ID != 0 and clc.transaction_id = (select max(distinct bb.transaction_id) from cst_layer_costs bb where bb.TRANSACTION_COST_ID != 0 and bb.inventory_item_id = Q_ITEM.inventory_item_id and bb.cost_date = (select max(distinct bbb.cost_date) from cst_layer_costs bbb where bbb.TRANSACTION_COST_ID != 0 and bbb.inventory_item_id = Q_ITEM.inventory_item_id))
with et as (select distinct esi.inventory_item_id, esi.item_number AS item_code
from fusion.egp_system_items_b esi where esi.item_number= <item> ) select * from fusion.CST_PERPAVG_COST a, et b where a.inventory_ITEM_id = b.inventory_item_id order by CREATION_DATE