У меня всегда возникают проблемы с Access SQL. Синтаксис требует случайного добавления скобок или перемещений вокруг, отличных от SQL Server. Кто-нибудь знает, что может быть синтаксическая ошибка здесь? Ошибка фокусируется вокруг предложения FROM
. Я знаю, что другие предложения в порядке, но я оставил их для справки.Ошибка синтаксиса в Access SQL View
Обновление: Упрощенный код намного больше. Меня в основном беспокоят положения 3 FROM
.
SELECT
...
FROM
(((maintable
INNER JOIN othertable ON (maintable.A = othertable.A) AND (maintable.B = othertable.B))
INNER JOIN
(SELECT
...
FROM
(thirdtable)
INNER JOIN fourthtable ON thirdtable.blah = fourthtable.blah
WHERE
fourthtable.something <> 1
GROUP BY
...
) AS innerselect1 ON (othertable.item = innerselect1.item) AND (othertable.whse = innerselect1.whse)) AS table1)
JOIN (
SELECT ...
FROM (othertable INNER JOIN maintable ON othertable.item = maintable.item)
GROUP BY ...
HAVING ...
) AS table2 ON table1.item = table2.item
WHERE
...
GROUP BY
...
HAVING
...
UNION ALL
SELECT
...
FROM
(((maintable
INNER JOIN othertable ON (maintable.A = othertable.A) AND (maintable.B = othertable.B))
INNER JOIN
(SELECT
...
FROM
(thirdtable)
INNER JOIN fourthtable ON thirdtable.blah = fourthtable.blah
WHERE
fourthtable.something <> 1
GROUP BY
...
) AS innerselect1 ON (othertable.item = innerselect1.item) AND (othertable.whse = innerselect1.whse)) AS table1)
LEFT JOIN (
SELECT ...
FROM (othertable INNER JOIN maintable ON othertable.item = maintable.item)
GROUP BY ...
HAVING ...
) AS table2 ON table1.item = table2.item
WHERE
table2.item IS NULL
GROUP BY
...
HAVING
...
UNION ALL
SELECT
...
FROM
(((maintable
INNER JOIN othertable ON (maintable.A = othertable.A) AND (maintable.B = othertable.B))
INNER JOIN
(SELECT
...
FROM
(thirdtable)
INNER JOIN fourthtable ON thirdtable.blah = fourthtable.blah
WHERE
fourthtable.something <> 1
GROUP BY
...
) AS innerselect1 ON (othertable.item = innerselect1.item) AND (othertable.whse = innerselect1.whse)) AS table1)
RIGHT JOIN (
SELECT ...
FROM (othertable INNER JOIN maintable ON othertable.item = maintable.item)
GROUP BY ...
HAVING ...
) AS table2 ON table1.item = table2.item
WHERE
table1.item IS NULL
GROUP BY
...
HAVING
...
;
Доступ может соединяться только с двумя таблицами в то время. Вам нужно много круглых скобок. – jarlh
Интересно, я этого не знал. – whatwhatwhat