query matching

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

query matching

Post by greedyisg00d »

I am trying to create some sort of couple matching. I have 2 tables namely Boy and Girl which both have the same fields which is shown below

ID
Name
Age
Birthdate
Bith Sign
Hobbies
Interests

I want to rank them according to the sample fields I provided above.

In the web form, the fields for Birth Sign, Hobbies and Interests are in drop down format so that I can limit the answer of the users therefore the matching process will be easier i guess.

I split up the data based on their gender and later on I plan to join the two tables together for the matching but right now I do not have any idea on what will be my sql query for the matching process.

Now I am having a difficulty on how can I display the result of the matching and the result must be in ranking order.

For example the result should somehow look like this.

| BOY | GIRL | RANK |
+====+====+=====+
| John | Sarah | 1 |
| John | Kate | 2 |
| John | Sammy | 3 |
| John | Donna | 4 |
| John | Tanya | 5 |

Any idea on how can this be done? Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: query matching

Post by requinix »

It'll greatly help if you can quantify (ie, give a number to) how close of a match two people are. Can you do that yet? What's the formula?
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

Re: query matching

Post by greedyisg00d »

right now I do not have a working formula and just trying things out. Can you give me an example how to match the data from two tables and the result will be shown in a single table. Thanks
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: query matching

Post by Eran »

The query can only represent the logic you use to match. You can't write a query without figuring out first how the matching would take place.. you can't program without knowing what you want the computer to do.
Post Reply