I have a join (I took the language from a crystal report "show query" window) that returns double records. The views joined
v_Combinetable1
v_Combinetable3
v_Combinetable2
are each unions of two identical tables in differing databases.
Can anyone shed light onto the below query returning duplicate (redundant) identical record sets?
Jason
SELECT
table2.dbname,table3.SOPTYPE, table3.GLPOSTDT, table3.VOIDSTTS,
table2.SOPTYPE, table2.SOPNUMBE, table2.ITEMNMBR, table2.ITEMDESC, table2.XTNDPRCE, table2.EXTDCOST,
table2.QUANTITY, table1.ITEMNMBR, table1.USCATVLS_5
FROM
{ oj (v_Combinetable3 table3 LEFT JOIN v_Combinetable2 table2 ON
table3.SOPNUMBE = table2.SOPNUMBE)
LEFT JOIN v_Combinetable1 table1 ON
table2.ITEMNMBR = table1.ITEMNMBR}
WHERE
table3.SOPTYPE >= 3 AND
table3.SOPTYPE <= 4 AND
table3.VOIDSTTS = 0 AND
table1.ITEMNMBR = 'CSS898P' AND
table1.USCATVLS_5 = 'D13Class' AND
table3.GLPOSTDT >= '01/11/2008' AND
table3.GLPOSTDT < '02/12/2008'
ORDER BY
table2.sopnumbe, table2.itemnmbr
v_Combinetable1
v_Combinetable3
v_Combinetable2
are each unions of two identical tables in differing databases.
Can anyone shed light onto the below query returning duplicate (redundant) identical record sets?
Jason
SELECT
table2.dbname,table3.SOPTYPE, table3.GLPOSTDT, table3.VOIDSTTS,
table2.SOPTYPE, table2.SOPNUMBE, table2.ITEMNMBR, table2.ITEMDESC, table2.XTNDPRCE, table2.EXTDCOST,
table2.QUANTITY, table1.ITEMNMBR, table1.USCATVLS_5
FROM
{ oj (v_Combinetable3 table3 LEFT JOIN v_Combinetable2 table2 ON
table3.SOPNUMBE = table2.SOPNUMBE)
LEFT JOIN v_Combinetable1 table1 ON
table2.ITEMNMBR = table1.ITEMNMBR}
WHERE
table3.SOPTYPE >= 3 AND
table3.SOPTYPE <= 4 AND
table3.VOIDSTTS = 0 AND
table1.ITEMNMBR = 'CSS898P' AND
table1.USCATVLS_5 = 'D13Class' AND
table3.GLPOSTDT >= '01/11/2008' AND
table3.GLPOSTDT < '02/12/2008'
ORDER BY
table2.sopnumbe, table2.itemnmbr