views:

217

answers:

3

is there a way to tell ms access (2003) to not put joins into parentheses. or at least to understand them without (every other database does)

i want something like:

    SELECT *
      FROM a
INNER JOIN b
        ON a.a = b.a
INNER JOIN c
        ON b.c = c.c

but access tells me that the query is wrong. IT’S NOT, and it’s driving me crazy …

it also puts all joins in a single line—impossible to read

thanks in advance.

ps. i already activated ANSI 92 compatibility/support in settings

+2  A: 

Sadly, no. Access 2003 is just that "dumb" about SQL. It is "wrong" in that Access can only parse one JOIN, which leaves you with the infuriating (but also still correct):

SELECT *
FROM a
INNER JOIN (b INNER JOIN c ON b.c = c.c)
    ON a.a = b.a
VoteyDisciple
thanks for your answer, that sucks. i still don’t understand why it needs those dumb parentheses though. to me they are really illogical
knittl
Why should anyone give a rat's ass about these parens?
David-W-Fenton
David W. Fenton: "Why should anyone [care] about these parens?" From the point of view of a human reading the code, they are unnecessary clutter. From the point of view of a human writing code, you may want to force the optimizer to do the join in an explicit order but the Access Database Engine doesn't let you do this (so yet another way in which it does not comply with SQL-92 even in so-called ANSI-92 Query mode <rolls eyes>).
onedaywhen
A: 

I just tried SQL Server Compantible Syntax (ANSI 92) and Checked This Database.

I tend to setup all my tables and joins in the graphic query builder and then customize in the SQL editor while working around all the parentheses. The usage of square brackets drives me crazy as well. I'm lucky, most of the apps in my firm are being migrated from Access to SQL Server.

Jeff O
yes, me too. all those parens and brackets are driving me nuts.
knittl
I certainly agree that if you hate Access and don't want to work by its conventions you should without question stop using it and use something else. But it's your loss.
David-W-Fenton
backend is on an ms sql server, frontend is access. why? because customers want it that way
knittl
+1  A: 

See the Access Help About ANSI SQL query mode (MDB).

This mode conforms closely to the ANSI-92 Level 1 specification, but is not ANSI-92 Level 1 compliant.

For "ANSI-92" read "ANSI/ISO SQL-92" (and for "conforms closely to" read "vaguely resembles" ).

Bottom line: you must include the parentheses. Note the Access database engine's optimizer may change the order of the tables as it sees fit.

onedaywhen
(and for "conforms closely to" read "vaguely resembles" ) <-- <3
knittl