Can anyone help me create a left outer join statement to work in MS Query?
Based on Hogan's answer, and this MSDN article, I've edited my SQL statement to this (below) but MS Query is still not happy.
SELECT CO.MATERIALS1 AS 'Material',
CO.`SIZES#1` AS 'Size',
CO.`TOOLS#1` AS 'Tool',
IR.`BODY /JAW` AS 'BodyJaw',
IR.PN AS 'PartNo'
FROM {oj `COMBINATIONS$` CO
LEFT OUTER JOIN `'INSERTS REVIEW$'` IR
ON [IR.TOOL LIKE '% ' CO.`TOOLS#1` ' %']
AND [IR.SIZE LIKE '% ' CO.`SIZES#1` ' %']
AND [IR.MATERIAL LIKE '% ' CO.MATERIALS1 ' %']}
The syntax for MS Query seems to be slightly different than standard SQL / T-SQL that I've worked with in the past, and I'm struggling to figure out what it wants.
The query above gives me this error about expecting a join operator:
I tried removing the curly braces { }
and it complains about table oj:
I tried removing the oj
reference and it complains about invalid bracketing:
And in frustration I tried removing all brackets, and that makes it complain about a missing operator syntax error:
Aside from that, I've tried quite a few variations on structure, escape characters, concatenation characters, etc. I feel like I'm just spinning my wheels here with MS Query, and hoping that someone more versed in the nuances of MSQ could point out where I'm going wrong, and help me make it right.
To be clear, here is what I'm looking to achieve.
I want to do a left join on the CO table, matching size, tool, and material on the IR table:
Which should yield this result:
Also, I realize this will return a match for "P12" on "P12" and "JP12" which is not really the desired behavior, but I feel I can work that out once I get this basic query working. If need be, I could probably add a leading or trailing "/" to every record in that field, so I can then match on "LIKE '%/'" or something like that.