The Left and Mid function was used because the 2 Tables to be joined are as below:
in that case your query A does not return what you believe it returns - a simple opening of the query would have shown that
left 3 returns '071' - fine
mid 4,5 returns '-3106' - not what you think
So assuming your queryA is wrong and it should be mid 5,5 you can stlll apply to xps's suggestion
Code:
SELECT A_Table1.[Part Number] FROM A_Table1 INNER JOIN B_Table2
ON Left(A_Table1.[Part Number], 3) & Mid(A_Table1.[Part Number], 5,5)= B_Table2.[Part Number]
or you can use a cartesian query
Code:
SELECT A_Table1.[Part Number] FROM A_Table1, B_Table2
WHERE Left(A_Table1.[Part Number], 3) & Mid(A_Table1.[Part Number], 5,5)= B_Table2.[Part Number]
To answer your question, nothing wrong with using an intermediate query, all 3 methods lose the benefit of indexing so will be slow for large volumes of data. Personally I try to avoid using them because of the lack of indexing but they are simple to apply. It all depends on the overall requirement.
To use indexing I might create an additional indexed column in table1 and populate it with the calculated value. Or I might create an intermediate table to link the two values. Or I might just index the field in table 1 and use a query like
Code:
SELECT A_Table1.[Part Number] FROM A_Table1, B_Table2
WHERE A_Table1.[Part Number] Like left(Table2.[Part Number],3) & "*" and Mid(A_Table1.[Part Number], 5,5)= mid(B_Table2.[Part Number],4)
not using an initial * with the Like means indexing can be used so the comparison on the 5 digits is on a much smaller non indexed recordset. As above, depends on your data. Your example shows all starting with 071, if that applies to all the data then not much point in this method