This question has likely been answered before but my search has returned no viable solutions. I am trying to append a column from a different table using inner join to allow access to both tables. This is using Microsoft Access and my code is as follows
SELECT Table1.* , Table2.AppendColumn
FROM Table1 INNER JOIN Table2 ON (Table1.foo = Table2.bar);
I have made sure the columns are of the same data type and would appreciate a more learned opinion.
Full error is
"Syntax error in query expression 'Table1.foo = Table2.ba'.
I do want all fields from the first table with only one column from the second table. i used the term append as it seemed accurate for what i'm doing although there is no matching or empty column in the other table. This shouldn't be any kind of special query i just created one using "Query Design" and wrote the code myself
Edit - This issue was caused by incorrect encapsulation on my end, didn't know about sql not likeing numbers at the beginning of list names, sorry for the confusion, and thanks to all who contributed.
The only likely issues you can be encountering here is if something is incorrectly referenced in your actual code. Or if there is a major flaw in the SQL structure itself (such as hidden characters messing things up).
Highly suggest checking the name of each table and both of the inner join column names for any possible reference errors.
This could be something finicky like "Table1.Foo Bar" but would need to be "Table1.[Foo Bar]" as Access does not accept spaces in references. Same would apply to any column starting with a number or a symbol.
Something like this:
SELECT Table1.* , Table2.[Append Column]
FROM Table1 INNER JOIN Table2 ON (Table1.[foo bar] = Table2.[1050])
But as it stands now, your code is correct as listed.