When querying for data. It's strange to write a piece of SQL. No duplicate data occurs when you query data from the first 5 tables
There is a lot of duplicate data until the sixth table is associated (t_im_inventorybalance ). For a time it was depressing. Then consult the implementation personnel to know.
The original t_im_inventorybalance itself has multiple duplicate data, which means that when Material.fid = Ib.fmaterialid Association
It's a one-to-many relationship. Multiple conditions need to be set to avoid duplication.
Select Material.fid from T_im_stocktransferbill STB
INNER JOIN T_im_stocktransferbillentry stbe on stb.fid= stbe.fparentid
Inner JOIN t_bd_material material on material.fid = Stbe.fmaterialid
INNER JOIN t_bd_materialcompanyinfo mci on material.fid = MCI. Fmaterialid
INNER JOIN T_db_warehouse WAREHOUSE on STBE. Fissuewarehouseid = Warehouse.fid
INNER JOIN t_im_inventorybalance ib on material.fid = Ib.fmaterialid
and ib. Fwarehouseid = Warehouse.fid and ..... The
inner join T_im_storestate storestate on ib. Fstorestatusid = Storestate.fid
inner join T_org_storage Storage on ib. Fstorageorgunitid = Storage.fid
and fbizdate >= (select Fbegindate from t_bd_period where fnumber = ' 200910 ') Br> and fbizdate <= (select Fenddate from t_bd_period where fnumber = ' 200910 ')
and warehouse.fnumber = ' K One '
and STB. Fbasestatus = 7
and ib. Fyear = 2009 and ib. Fperiod = Ten
and STB. Fissuestorageorgunitid = ' 4ueezzgdsyuvfad/hlhijsznrtq= '
and STB. Freceiptstorageorgunitid
in (' ewbcbd/zq1+ebrrzduxf3cznrtq= ', ' acgiadkit7cs4dp40u7ktcznrtq= ',
' nxnw4ggnrh+axz/cmemfpcznrtq= ', ' 8vjd+kzurluqlkf2ysz3b8znrtq= ',
' 7b2aymbeskghpqv8xiks3cznrtq= ')