左外连接访问?

时间:2012-05-11 08:16:49

标签: ms-access

以下查询在访问时无效。

SELECT Fields.FieldId, PrecisionSettings.DecimalPlaces 

    from Fields left outer join FieldGroup on Fields.FieldGroupId = FieldGroup.FieldGroupId

    left outer join Category on FieldGroup.CategoryId = Category.CategoryId

    left outer join PrecisionSettings on 

    Category.InputAttributesID=PrecisionSettings.AttributesID

它在查询表达式中将错误视为缺少运算符。

1 个答案:

答案 0 :(得分:5)

在Access中,您一次只能加入两个结果。要加入更多表格,您需要更多括号:

SELECT
    Fields.FieldId,
    PrecisionSettings.DecimalPlaces 
FROM
(
    (
        Fields
        LEFT OUTER JOIN FieldGroup ON Fields.FieldGroupId = FieldGroup.FieldGroupId
    )
    LEFT OUTER JOIN Category ON FieldGroup.CategoryId = Category.CategoryId
)
LEFT OUTER JOIN PrecisionSettings ON Category.InputAttributesID = PrecisionSettings.AttributesID