如果我只是查询主表OEINDLID,我将只获得一半的行。
即使执行此查询/ 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
但是当我们在连接处添加我们想要的部分#data(重量等)然后加载运输数据时 我们得到这个:
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这里有一个内部连接。
答案 0 :(得分:0)
尝试SELECT DISTINCT:
INNER JOIN (SELECT DISTINCT
MHORDP, MHSTAT, MHZONR, MHSHIN
FROM ASTDTA.MFHHMHPK) AS T03 ON T01.IDORD# = T03.MHORDP