0

I have a table that shows relationships between items and another table with the items themselves:

articles_to_articles
-------------------------
|articleID_1|articleID_2|
-------------------------
|12345      |67890      |
|23442      |343243     |
-------------------------

articles
-----------------------------------------------------
|article_id | article_name|lots | of | other | stuff|
-----------------------------------------------------

I am attempting to generate a file with that consists of the relationships from articles_to_articles but with the names in addition to the ids. What I have so far is:

    SELECT
    a2a.articleID_1,
    key_articles.article_name,
    a2a.articleID_2,
    val_articles.article_name 
FROM
    articles_to_articles a2a
INNER JOIN
    articles key_articles 
        ON key_articles.articleID = articles_to_articles.articleID_1 
INNER JOIN
    articles val_articles 
        ON val_articles.articleID = articles_to_articles.articleID_2;

Access gives me a "missing operator" error but I can't seem to find the missing operator. What basic thing am I missing?

Isaac
  • 625
  • 1
  • 12
  • 30
  • 1
    [Access requires parentheses in the FROM clause for queries which include more than one join.](https://stackoverflow.com/a/20929533/77335) – HansUp Jul 26 '18 at 21:47
  • Thank you! There's always something, and you taught me yet another useful syntactic detail – Isaac Jul 26 '18 at 22:24

1 Answers1

0

When joining more than two tables in MS Access, you must enclose each join within separate groups of parentheses, for example:

SELECT
    a2a.articleID_1,
    key_articles.article_name,
    a2a.articleID_2,
    val_articles.article_name 
FROM
    (
        articles_to_articles a2a
        INNER JOIN
        articles key_articles 
        ON 
        key_articles.articleID = a2a.articleID_1 
    )
    INNER JOIN
    articles val_articles 
    ON 
    val_articles.articleID = a2a.articleID_2
Lee Mac
  • 15,615
  • 6
  • 32
  • 80