1. 程式人生 > >物料表的分組前臺跟後臺不一樣

物料表的分組前臺跟後臺不一樣

物料表

場景:當物料表的分組前臺跟後臺不一樣的情況或是前臺刪除分組提示有明細數據時;


一、查詢出分組對應的fid;

select * from T_BD_MATERIALGROUP_L where fname like '%000%'

二、找出對應的物料fnumber;

select a.fnumber from T_BD_MATERIAL a

left join (select fid,fname From T_BD_MATERIALGROUP_L ) t4 on a.FMATERIALGROUP=t4.fid

where t4.fname like '%000%' and FMATERIALGROUP=16416826

三、更新;

update a set a.FMATERIALGROUP=12258320 from T_BD_MATERIAL a

left join (select fid,fname From T_BD_MATERIALGROUP_L ) t4 on a.FMATERIALGROUP=t4.fid

where t4.fname like '%000%' and FMATERIALGROUP=16416826


物料表的分組前臺跟後臺不一樣