Syntax errors with Add Command and Left Outer Join

SULLY1

VIP Member
I'm having a heck of a time getting multiple left joins to work using the Add Command. I'm using F0911 as the primary file and want to Left join to F4311 and then Left join F4311 to F4101. I'm getting syntax errors with the code below. I'm I close?

SELECT
"F0911"."CompanyKey",
"F0911"."DocumentType",
"F0911"."DocVoucherInvoiceE",
"F0911"."DateForGLandVoucherJULIA",
"F0911"."GLPostedCode",
"F0911"."CostCenter",
"F0911"."ObjectAccount",
"F0911"."LedgerType",
"F0911"."FiscalYear1",
"F0911"."AmountField",
"F0911"."NameAlphaExplanation",
"F0911"."NameRemarkExplanation",
"F0911"."Reference2",
"F0911"."DocumentTypePurchase",
"F0911"."AddressNumber",
"F0911"."PurchaseOrder",
"F0911"."PurchaseOrderSuffix",
"F0911"."LineNumber",
"F4311"."CompanyKeyOrderNo",
"F4311"."DocumentOrderInvoiceE",
"F4311"."OrderType",
"F4311"."OrderSuffix",
"F4311"."LineNumber",
"F4311"."IdentifierShortItem",
"F4311"."Identifier2ndItem",
"F4101"."IdentifierShortItem",
"F4101"."DescriptionLine1",
"F4101"."DescriptionLine2"
FROM
("F0911" "F0911" LEFT OUTER JOIN "F4311" "F4311"
ON "F0911"."CompanyKey"="F4311"."CompanyKeyOrderNo"
ON "F0911"."DocumentTypePurchase"="F4311"."OrderType"
ON "F0911"."PurchaseOrderSuffix"="F4311"."OrderSuffix"
ON "F0911"."LineNumber"="F4311"."LineNumber"
ON Convert(numeric,"F0911"."PurchaseOrder")="F4311"."DocumentOrderInvoiceE")
LEFT OUTER JOIN "F4101" F4101" ON
"F4311"."IdentifierShortItem"="F4101"."IdentifierShortItem"

Thanks in advance for you help.
 
The syntax error is right here:

("F0911" "F0911" LEFT OUTER JOIN "F4311" "F4311"
ON "F0911"."CompanyKey"="F4311"."CompanyKeyOrderNo"
ON "F0911"."DocumentTypePurchase"="F4311"."OrderType"
ON "F0911"."PurchaseOrderSuffix"="F4311"."OrderSuffix"
ON "F0911"."LineNumber"="F4311"."LineNumber"
ON Convert(numeric,"F0911"."PurchaseOrder")="F4311"."DocumentOrderInvoiceE")

Only the first ON is allowed here. All other parts of the JOIN condition are connected via AND or OR (just like in a WHERE clause). So the above should be:

("F0911" "F0911" LEFT OUTER JOIN "F4311" "F4311"
ON "F0911"."CompanyKey"="F4311"."CompanyKeyOrderNo"
AND "F0911"."DocumentTypePurchase"="F4311"."OrderType"
AND "F0911"."PurchaseOrderSuffix"="F4311"."OrderSuffix"
AND "F0911"."LineNumber"="F4311"."LineNumber"
AND Convert(numeric,"F0911"."PurchaseOrder")="F4311"."DocumentOrderInvoiceE")

Also, the fragment LEFT OUTER JOIN "F4101" F4101" ON is missing a quotation mark before the second F4101.

2.
 
Bill

Thanks for the response. I ended up doing a pure SQL read instead.

Patty
 
Back
Top