Currently debugging a piece of code to fit into an Access SQL query.
Code is as follows:
select tk, tk2, count(*), count(a2.tk) / count(*) as ratio
from ((select distinct a.TK, a2.TK as tk2
from access3 as a join
access3 as a2
on (a.DocumentNo = a2.DocumentNo)
where a.TK <> a2.TK
) tt left join
access3 as a
on (a.tk = tt.tk)
) left join
access3 as a2
on (a2.tk = tt.tk2 and a2.DocumentNo = a.DocumentNo)
group by tk, tk2;
I looked it up and found this post
"join expression not supported" in Access
So I tried putting in the parentheses. When I hit run, it takes me to line
(a2.tk = tt.tk2 and a2.DocumentNo = a.DocumentNo)
And highlights it. So something about this line it doesn't like.
I think I understand how to rewrite the join code, but how do you rewrite the left join code to satisfy Access's picky requirements?
Or, is there a better program to use where I can just connect to Access and copy and paste the code in? I tried the free version of DBeaver but I assume it's too much to handle as it brings back 200 lines of query (That are wrong) that took 5 minutes to load, and when I scroll down it re-queries and pulls in more data that is also wrong.
Tried a sample size in DB Fiddle and it works perfectly, so the code works, just DBeaver is not doing it properly for some reason.