8、删除cux_bill_temp表
delete cux_bill_temp;
9、再重cux_bill_a表中把数据导入给cux_bill_temp表,完成把重复数据剔除的功能
insert into cux_bill_temp(
assembly_item,
component_item,
component_quantity,
PLANNING_FACTOR,
component_yield_factor,
supply_type,
supply_subinventory,
OPTIONAL_disp,
MUTUALLY_EXCLUSIVE_O_disp,
attribute1,
row_num)
select assembly_item,
component_item,
component_quantity,
PLANNING_FACTOR,
component_yield_factor,
supply_type,
supply_subinventory,
OPTIONAL_disp,
MUTUALLY_EXCLUSIVE_O_disp,
attribute1,
row_num
from cux_bill_a;
10、删除表cux_bill_a
drop table cux_bill_a;
11、再检查一次表,是否有重复的数据
select assembly_item,component_item,min(row_num),count(*)
from cux_bill_temp
group by assembly_item,component_item
having count(*)>1;
12、查看在mtl_system_items表中,既是在库存表中,有没有不存在的Item.
select distinct item
from (
select distinct assembly_item item
from cux_bill_temp b
where not exists (select null from mtl_system_items where segment1=b.assembly_item and organization_id=2)
union
select distinct component_item item
from cux_bill_temp b
where not exists (select null from mtl_system_items where segment1=b.component_item and organization_id=2)
)
order by item;
