Query to return rows from other table base on number of matches

S

stabilo

I had similar question that was perfectly answered by Amy Blankenship and
John Spencer. Thanks !!!
The question I have now is related to the last one but a bit more detailed.
I have two tables :

T1:
---
J1 S1
J1 S2
J1 S5
J1 S6
J1 S7
J2 ..

T2 :
---
U1 J1 S1
U2 J1 S1
U2 J1 S2
U2 J1 S6
U3 J1 S1
U3 J1 S2
U3 J1 S5
U3 J1 S6
U3 J1 S7
U3 J1 S8
U4 J1 S10


I'd like to be able to get the U's based on the of S's of table T2 they
match in T1 (in this case U1, U2, U3 but not U4. But with a variable that
will allow me to decide the percentage of exact match. Let's that I want the
U's that match 5 S's I will have only U3 becuase it has the exact number of
matching S's. If I ask at least 3 S's, I will have U2 and U3. If I ask at
least 1, I will have U1, U2, U3.

I know that this seems to be hard to do with a query and will requires a few
queries. Any help will be more than welcome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top