2014-03-04 51 views
1

我一直在試圖找出爲什麼我得到缺少操作符錯誤而不是他的查詢。查詢中缺少訪問操作符

查詢如下:

SELECT DISTINCT 
    FLEET.regno 
, SUBMODEL.submodel 
, FLEET.icao 
, FLEET.startyr 
, CARRIERS.sector 
FROM (FLEET 
INNER JOIN SUBMODEL 
ON FLEET.[M/S/Variant] = SUBMODEL.[M/S/Variant] 
INNER JOIN LOOKUP 
ON 
    (SUBMODEL.SUBMODEL = LOOKUP.SUBMODEL 
    AND FLEET.ICAO = LOOKUP.ICAO) 
INNER JOIN CARRIERS 
ON FLEET.icao = CARRIERS.ICAO) 
WHERE (
    LOOKUP.[ASM/ac] is not null 
    OR LOOKUP.[ATM/ac] is not null 
) AND FLEET.status = 'ACTIVE'; 

Access 2010中拋出以下錯誤:

Syntax error (missing operator in query expression 'FLEET.[M/S/Variant] = SUBMODEL.[M/S/Variant] INNER JOIN LOOKUP ON (SUBMODEL.SUBMODEL = LOOKUP.SUBMODE'.

我試圖把括號在不同的地方,但仍運行到問題。有什麼我在這裏失蹤。

+2

。 。訪問需要每個聯合組合周圍的括號。這是醜陋的,但需要。 –

+0

你可以更具體一點 - 在INNER JOIN()這個詞之後? - 或者至少指出我在想什麼?我明白,它需要括號,但在任何地方都沒有看到一個很好的例子,顯示我應該寫什麼。謝謝 – Jeef

回答

2

我們固定它:

SELECT DISTINCT 
    FLEET.regno 
, SUBMODEL.submodel 
, FLEET.icao 
, FLEET.startyr 
, CARRIERS.sector 
FROM ((FLEET 
INNER JOIN SUBMODEL 
ON FLEET.[M/S/Variant] = SUBMODEL.[M/S/Variant]) 
INNER JOIN LOOKUP 
ON 
    SUBMODEL.SUBMODEL = LOOKUP.SUBMODEL 
    AND FLEET.ICAO = LOOKUP.ICAO) 
INNER JOIN CARRIERS 
ON FLEET.icao = CARRIERS.ICAO 
WHERE (
    LOOKUP.[ASM/ac] is not null 
    OR LOOKUP.[ATM/ac] is not null 
) AND FLEET.status = 'ACTIVE'; 
+0

這很奇怪 - 根據我的經驗,Access不支持'on'子句中的多個條件。 – Yawar