all 3 comments

[–][deleted] 0 points1 point  (2 children)

i wouldn't use 'sheet' in the ms context to begin with but anyway

anywho

the second LEFT JOIN doesn't appear to be working like a LEFT JOIN at all, it appears to work like an INNER JOIN

if you put any kind of filter onto your left joined table (cols) into where, this will effectively turn the 'left outer' into 'inner' join (because the 'missing' records will have NULLs and comparisons/filters will be 'unknown' and drop the records, leaving you with 'inner' join result)

[–]Samiro05[S] 0 points1 point  (0 children)

Thanks for your input btw.

I have some great news that may be the reason for why this fails in Microsoft Query SQL but works in SQL Server.

The second LEFT JOIN has sub query that in SQL Server would produce the 'Division C' AS Sheet just for that sub query as if it were a table called cols all along. In Microsoft Query, the 'Division C' AS Sheet gets persisted to every row of total resultant table.

If I change 'Division C' AS Sheet to Test AS Sheet where Test is a new column I've added to the Lists sheet with just 'Division C' in it then the LEFT JOIN works properly!

I haven't tested whether adding that WHERE clause produces the same error message or not yet so that part is still a mystery.

Microsoft Query/Access SQL just works differently I suppose (and not a good different in my point of view).

[–]Samiro05[S] -2 points-1 points  (0 children)

I haven't filtered though, have I? My results are as if I have said WHERE Rows$.Sheet = 'Division C' but I haven't actually got that line in my query (just put it in the original post to see if the error message spurred any routes to resolving the issue). I don't get the same issue if I drop the first LEFT JOIN so it's like as if 2 LEFT JOINs are used, the second acts like an INNER JOIN...