I tried using UNION, gives me the same result. i.e.
for each record in Table A, shows all records from table B.
for example: table A has 2 records and table B has 3 records, it displays
tableA_item.1
tableB_item.1
tableB_item.2
tableB_item.3
tableA_item.2
tableB_item.1
tableB_item.2
tableB_item.3
Yes, the itemID is unique on both tables. The only similar field is SessionID where I do TableA LEFT join to Table B since sometimes Table B is empty, so I want all records from Table A and all records from Table B. I am using
crystal ver. 8.5. SQL Server 2000. Here's the actual SQL
that I used with UNION.
Table A is tsoPickListDetWrk
Table B is tsoPickListDetWrk_NMDP2
I want to display all records from both tables. I appreciate your help very much.
SELECT
tsoSOLineDist."OrigOrdered",
tsoPickListDetWrk."Comments", tsoPickListDetWrk."CustID", tsoPickListDetWrk."CustName", tsoPickListDetWrk."DefltShipDate", tsoPickListDetWrk."DefltShipMethID", tsoPickListDetWrk."DefltShipPriority", tsoPickListDetWrk."HeaderCmnt", tsoPickListDetWrk."ItemDescription", tsoPickListDetWrk."ItemID", tsoPickListDetWrk."KitShipLineKey", tsoPickListDetWrk."PickListNo", tsoPickListDetWrk."QtyToPick", tsoPickListDetWrk."ReqDelvDate", tsoPickListDetWrk."RcvgWhseID", tsoPickListDetWrk."RcvgWhseName", tsoPickListDetWrk."ShipDate", tsoPickListDetWrk."ShipMethID", tsoPickListDetWrk."ShipMethKey", tsoPickListDetWrk."ShipPriority", tsoPickListDetWrk."ShipToAddrCity", tsoPickListDetWrk."ShipToAddrCount", tsoPickListDetWrk."ShipToAddrLine1", tsoPickListDetWrk."ShipToAddrLine2", tsoPickListDetWrk."ShipToAddrLine3", tsoPickListDetWrk."ShipToAddrLine4", tsoPickListDetWrk."ShipToAddrLine5", tsoPickListDetWrk."ShipToAddrName", tsoPickListDetWrk."ShipToAddrPsCode", tsoPickListDetWrk."ShipToAddrStateID",
tsoPickListDetWrk."SOLineDistKey", tsoPickListDetWrk."TranNoRelChngOrd", tsoPickListDetWrk."TranType", tsoPickListDetWrk."UOM", tsoPickListDetWrk."WhseBinID",
timItem."UserFld1",
tarCustomer."UserFld1",
tsoPickListDetWrk_NMDP."PrevShippedQty"
FROM
{ oj (((("SES_app"."dbo"."tsoSOLineDist" tsoSOLineDist INNER JOIN "SES_app"."dbo"."tsoPickListDetWrk" tsoPickListDetWrk ON
tsoSOLineDist."SOLineDistKey" = tsoPickListDetWrk."SOLineDistKey"

INNER JOIN "SES_app"."dbo"."tarCustomer" tarCustomer ON
tsoPickListDetWrk."CustID" = tarCustomer."CustID"

INNER JOIN "SES_app"."dbo"."timItem" timItem ON
tsoPickListDetWrk."ItemID" = timItem."ItemID"

INNER JOIN "SES_app"."dbo"."tsoPickListDetWrk_NMDP" tsoPickListDetWrk_NMDP ON
tsoPickListDetWrk."SessionID" = tsoPickListDetWrk_NMDP."SessionID" AND
tsoPickListDetWrk."SOLineDistKey" = tsoPickListDetWrk_NMDP."SOLineDistKey"

LEFT OUTER JOIN "SES_app"."dbo"."tsoPickListDetWrk_NMDP2" tsoPickListDetWrk_NMDP2 ON
tsoPickListDetWrk."SessionID" = tsoPickListDetWrk_NMDP2."SessionID"}
ORDER BY
tsoPickListDetWrk."TranType" ASC,
tsoPickListDetWrk."TranNoRelChngOrd" ASC,
tsoPickListDetWrk."WhseBinID" ASC,
tsoPickListDetWrk."CustName" ASC,
tsoPickListDetWrk."ShipMethID" ASC,
tsoPickListDetWrk."ShipMethKey" ASC,
timItem."UserFld1" ASC,
tsoPickListDetWrk."ItemID" ASC
UNION
SELECT
tsoPickListDetWrk_NMDP2."itemDescription", tsoPickListDetWrk_NMDP2."QtyShipped", tsoPickListDetWrk_NMDP2."QtyOpentoShip", tsoPickListDetWrk_NMDP2."UOM", tsoPickListDetWrk_NMDP2."Location", tsoPickListDetWrk_NMDP2."itemID", tsoPickListDetWrk_NMDP2."PrevShippedQty"
FROM
{ oj (((("SES_app"."dbo"."tsoSOLineDist" tsoSOLineDist INNER JOIN "SES_app"."dbo"."tsoPickListDetWrk" tsoPickListDetWrk ON
tsoSOLineDist."SOLineDistKey" = tsoPickListDetWrk."SOLineDistKey"

INNER JOIN "SES_app"."dbo"."tarCustomer" tarCustomer ON
tsoPickListDetWrk."CustID" = tarCustomer."CustID"

INNER JOIN "SES_app"."dbo"."timItem" timItem ON
tsoPickListDetWrk."ItemID" = timItem."ItemID"

INNER JOIN "SES_app"."dbo"."tsoPickListDetWrk_NMDP" tsoPickListDetWrk_NMDP ON
tsoPickListDetWrk."SessionID" = tsoPickListDetWrk_NMDP."SessionID" AND
tsoPickListDetWrk."SOLineDistKey" = tsoPickListDetWrk_NMDP."SOLineDistKey"

LEFT OUTER JOIN "SES_app"."dbo"."tsoPickListDetWrk_NMDP2" tsoPickListDetWrk_NMDP2 ON
tsoPickListDetWrk."SessionID" = tsoPickListDetWrk_NMDP2."SessionID"}
ORDER BY
tsoPickListDetWrk_NMDP2."itemID" ASC