Question

I am trying to request with a mid in the ON clause

SELECT ....
FROM T1 as t1 LEFT JOIN T2 as t2 on MID(t1.f1, 1, 13) = MID(t2.f2, 1, 13)

And It refuse to work

JOIN expression not supported

If I run the exact same query without the mid It work perfectly fine (execpt I don't get the walue I want)

I tryed to externalise the mids into two request. But It still didn't work with the mid (and work without).

How can I do this request ?

Was it helpful?

Solution

No, Access only supports joining by field value, not by expression. You can join subqueries, though:

SELECT ....
FROM (SELECT *, MID(t1.f1, 1, 13) KeyValue FROM T1) as t1 
LEFT JOIN (SELECT *, MID(t2.f2, 1, 13) KeyValue FROM T2) as t2
    ON t1.KeyValue = t2.KeyValue
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top