GeeCON Prague 2014*
The moose likes JDBC and the fly likes How to write query to obtain not 100% match? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to write query to obtain not 100% match?" Watch "How to write query to obtain not 100% match?" New topic
Author

How to write query to obtain not 100% match?

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Dear experts,

I manage to come up with the 'matching' codes.

However, it doesn't produce exactly what I want and I'm stuck so I hope someone can advise me the correct way to do the query. Thanks.

What I'm trying to achieve is:

Parents ID and contact together with the tutors name and contact and subjects taught will be displayed once a match is found.

However, I want not just perfect match. I want something like a 80% match also be displayed.

So I try to put in (Parents.strSubjectsP LIKE '%' = Member.strSubject)

So tutor that can teach the subjects that the parents want and able to teach other subjects be displayed as well, not just the 100% match.


Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4398
    
    8

I think the first thing you need to do is define what you mean by "80% match". There's no absolute definition of this - you need to decide what it means. Once you've done that, then you can work out how to write a query for it.
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
Basically what I want is that if the tutor's subjects and the parent's subjects are matched, it will be displayed.

Now, it gives me 100% match only :

Math = Math.

But I want to include Math, Science = Math also be included.

Hence I use the parent.subject LIKE '%' = member.subject.

Could you tell me how to query something like that and it will auto run every time the program is run? Thanks.
 
GeeCON Prague 2014
 
subject: How to write query to obtain not 100% match?