Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2002
    Posts
    189

    Unanswered: multiple inner joins - syntax?

    Hi,

    What I want is hopefully explained by the following:

    SELECT
    tblObjectCommands.userLevel,
    tblObjectCommands.userIncrement,
    tblObjectCommands.commandResponse,
    tblCommands.commandText,
    tblObjects.objectName,
    tblRooms.roomName
    FROM tblObjectCommands
    INNER JOIN tblCommands ON tblObjectCommands.commandID=tblCommands.id
    INNER JOIN tblObjects ON tblObjectCommands.objectID=tblObjects.id
    INNER JOIN tblRooms ON tblObjectCommands.roomID=tblRooms.id
    WHERE tblCommands.id=2;


    ...which doesn't work. I get an error from Access about missing operators in query expressions.

    I tried recreating this query using Access's query builder thing, and it gave me something that didn't pull out the rows I was expecting it to, and that had far too many brackets round it to be healthy.

    Could someone show me how to write the above query so that Access likes it?

    Thanks.

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Believe it or not Access needs the brackets when using joins.... In your case it would be...

    SELECT
    tblObjectCommands.userLevel,
    tblObjectCommands.userIncrement,
    tblObjectCommands.commandResponse,
    tblCommands.commandText,
    tblObjects.objectName,
    tblRooms.roomName
    FROM
    ((tblObjectCommands
    INNER JOIN tblCommands ON tblObjectCommands.commandID=tblCommands.id)
    INNER JOIN tblObjects ON tblObjectCommands.objectID=tblObjects.id)
    INNER JOIN tblRooms ON tblObjectCommands.roomID=tblRooms.id
    WHERE tblCommands.id=2;

    Regards

  3. #3
    Join Date
    Jan 2002
    Posts
    189
    Thankyou very much

  4. #4
    Join Date
    May 2012
    Posts
    1
    Quote Originally Posted by namliam View Post
    Believe it or not Access needs the brackets when using joins.... In your case it would be...

    SELECT
    tblObjectCommands.userLevel,
    tblObjectCommands.userIncrement,
    tblObjectCommands.commandResponse,
    tblCommands.commandText,
    tblObjects.objectName,
    tblRooms.roomName
    FROM
    ((tblObjectCommands
    INNER JOIN tblCommands ON tblObjectCommands.commandID=tblCommands.id)
    INNER JOIN tblObjects ON tblObjectCommands.objectID=tblObjects.id)
    INNER JOIN tblRooms ON tblObjectCommands.roomID=tblRooms.id
    WHERE tblCommands.id=2;

    Regards
    Thanks namliam
    I'd the same problem...not its solved []

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •