nola94
nola94

Reputation: 251

Left Inner Join 5 tables

I am trying to left inner join 5 tables. I SELECT 4 columns, then I wrote

FROM table_a 
LEFT INNER JOIN table_b 
LEFT INNER JOIN table_c 
LEFT INNER JOIN table_d 
ON table_a.a = table_b.a, 
table_b.c=table_c.c, 
table_c.b=table_d.b

But when I try to run this on SQL in Access 2007, it tells me there is an error in the FROM code. I have really no idea what I am doing wrong.

Thanks for any help you can give me.

Upvotes: 1

Views: 511

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269973

MS Access requires parentheses around joins:

FROM ((table_a LEFT JOIN
       table_b
       ON table_a.a = table_b.a
      ) LEFT INNER JOIN
      table_c
      ON table_b.c = table_c.c
     ) LEFT JOIN
     table_d
     ON table_c.b = table_d.b

If you intend INNER JOIN then replace LEFT JOIN with INNER JOIN.

In addition:

  • There is no such thing as LEFT INNER JOIN.
  • MS Access uses LEFT JOIN for a left outer join.
  • You should put the ON clause immediately after the table/subquery after the JOIN.
  • Parentheses are needed for both inner and outer joins.

Upvotes: 3

Related Questions