0
這是查詢時,我運行它它給了我重複的記錄,但我刪除INNER JOIN planingOrderBookHeader PLOH ON sd.StyleID=PLOH.StyleID
和PLOH.OderBookID
列,它給記錄沒有重複,但我需要記錄與列名PLOH.OderBookID
我該如何解決這個問題?雖然我在SQL Server 2008 R2中使用「Distinct」和「Group By」,但爲什麼使用內部連接但記錄重複?
SELECT
CPO.ID
,CPO.StyleID
,cpo.CustomerPo
,PLOH.OderBookID
,cpo.Process
,CPD.Qty
,cpd.RefID
,cpd.Uom
,UM.MeshType
,PRC.Name
,STC.NewStyleno
,SD.TypeID
,itm.Name Part
,SD.ColorID
,COL.Name Color
,SD.FabricID
,FAB.Name Faric
,SHD.ItemID
,ITD.Name Item
,SHD.Image
FROM CustomerPO_Header CPO
INNER JOIN styleconfirmHeader STC ON STC.StyleID=CPO.StyleID
INNER JOIN CustomerPo_Details CPD ON CPO.ID=CPD.CusPOHeaderID
INNER JOIN StyleHeader SHD ON SHD.StyleID=CPO.StyleID
INNER JOIN StyleDetails SD ON CPO.StyleID=SD.StyleID
INNER JOIN ItemDetails itm ON SD.TypeID=itm.ID
INNER JOIN ColorDetails COL ON SD.ColorID=COL.ID
INNER JOIN ItemFabricDetails FAB ON FAB.ID=SD.FabricID
INNER JOIN UOM UM ON Um.ID=CPD.Uom
INNER JOIN ItemTypeDetails ITD ON SHD.ItemID=ITD.ID
INNER JOIN process PRC ON PRC.ID=CPO.Process
INNER JOIN planingOrderBookHeader PLOH ON sd.StyleID=PLOH.StyleID
PLZ幫我
謝謝親愛的它不工作 – tharinda 2014-09-04 07:08:04