Jump to content

Comparing Two Database Tables


adaminms

Recommended Posts

I want to make a site that has two different groups of people.

 

Note, this is all under the same database, just using two different tables.

 

One table has one group of people while the other has another.

 

I want Group 1 to be able to be able to find all of the people in group 2 that have information in common.

 

Not necessarily all of the information identical, but I want it to be organized something like this...

 

Group 1 Member 1 searches, and he finds a few results.

 

Group 2 Member 8 has 3 things in common.

Group 2 Member 92 has 3 things in common.

Group 2 Member 16 has 2...

 

And then just list them from the most things in common, down to the least.

Link to comment
https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/
Share on other sites

It's better if I just explain what it's for.

 

This is want I want to actually happen in the programming.

 

 

Step 1 Employees put in their information.

 

Step 2 Information is saved to the Employees database.

 

Step 3 Information in the Employers is cross-referenced with the information the Employee put in.

 

Step 4 A list of information is made, starting with the row of information with the most in common to the information that the Employee gave, and ends with the least in common.

 

Perhaps something like this is what you're looking for:

//get the count, used to find percentages
$sql = "SELECT COUNT(id) FROM employers";

//find how common a certain field is
$sql = "SELECT COUNT(id) FROM employers WHERE gender = 'MALE'";

//find another certain field, etc., etc. storing the results in an key/value array
//where the value is the percentage

//Then just sort the array and print it out

Not sure if the is the best solution

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.