0
如果我只是在主表OEINDLID上查詢,我將只獲得一半的行。SQL查詢從AS/400服務器返回重複項
即使執行此查詢/ 400正在返回重複項,我該如何解決這個問題?
SELECT T01.IDORD#, T01.IDDOCD, T01.IDPRT#, T01.IDSHP#, T01.IDNTU$,
(IDNTU$*(IDSHP#)) AS LINTOT, T02.IAPTWT, T02.IARCC3, T03.MHSTAT, T03.MHZONR,
T03.MHSHIN, T01.IDORDT, T01.IDHCD3
FROM ASTDTA.OEINDLID T01 INNER JOIN
ASTDTA.ICPRTMIA T02
ON T01.IDPRT# = T02.IAPRT# INNER JOIN
astdta.MFHHMHPK T03
ON T01.IDORD# = T03.MHORDP
WHERE IDHCD3 in ('MDL','TRP')
所需要的數據是這樣的:
322.05000000 04662926 RTR US-LUCU810 19.00 16.950000
.00000000 04662926 RTR ENUSLUCU810 19.00 .000000
.00000000 04662926 RTR EXTRA CHAR CHG 1.00 .000000
284.05000000 04662926 RTR US-LUCU79 19.00 14.950000
.00000000 04662926 RTR ENUSLUCU79 19.00 .000000
4.75000000 04662926 RTR EXTRA CHAR CHG 19.00 .250000
47.50000000- 04662926 RTR DISCLU 19.00 2.500000-
28.50000000- 04662926 RTR DISCLU 19.00 1.500000-
454.75000000- 04662926 RTR DISCEN 1.00 454.750000-
49.90000000 04662926 RTR FRTTRP 1.00 49.900000
297.50000000 04662926 RTR US-DGBB1 250.00 1.190000
162.50000000 04662926 RTR CRDGBOX 250.00 .650000
125.00000000 04662926 RTR ENGDGT 250.00 .500000
175.00000000 04662926 RTR EXTRA CHAR CHG 1,750.00 .100000
297.50000000 04662926 RTR US-DGBB1 250.00 1.190000
162.50000000 04662926 RTR CRDGBOX 250.00 .650000
125.00000000 04662926 RTR ENGDGT 250.00 .500000
275.00000000 04662926 RTR EXTRA CHAR CHG 2,750.00 .100000
50.00000000- 04662926 RTR DISCMD 500.00 .100000-
50.00000000- 04662926 RTR DISCMD 500.00 .100000-
622.50000000 04662926 RTR US-CM08RG 250.00 2.490000
100.00000000 04662926 RTR RIWRWB 250.00 .400000
125.00000000 04662926 RTR ENMD24BLK 250.00 .500000
.00000000 04662926 RTR EXENGMD 1.00 .000000
75.00000000- 04662926 RTR DISCMD 250.00 .300000-
135.30000000 04662926 RTR FRTMDL 1.00 135.300000
,但是當我們在添加加入到我們希望的一部分#數據(重量等),然後航運數據 我們得到這樣的:
04662926 20,140,116 CRDGBOX 250.00 .650000 162.50000000 .02000
04662926 20,140,116 CRDGBOX 250.00 .650000 162.50000000 .02000
04662926 20,140,116 CRDGBOX 250.00 .650000 162.50000000 .02000
04662926 20,140,116 CRDGBOX 250.00 .650000 162.50000000 .02000
你可以在CRDGBOX的例子中看到我們在上面有2個,但是在這裏我們有4個內部連接。
你的連接被想必創建重複行。你不能提供足夠的信息來說更多的東西。 –
需要告訴你什麼? –
提供樣本數據,結果和所需結果。 –