Match Records

From: Date: Mon, 05 Mar 2001 16:03:54 +0000
Subject: Match Records
Groups: php.general 
Request: Send a blank email to php-general+get-42624@lists.php.net to get a copy of this message
I`m trying to find the best method to match records between two tables in a MySQL database. But it must match atleast once, so here is a scenario for you to think about. Member - Job, Salary, Location Jobs - Job, Salary, Location All values will be enum sets in both tables as follows Job = enum 'developer','designer','none' Salary = enum '10K','15K','none' Location = enum 'usa','uk','none' Ok so the user has come to the site and I have his Job Salary and Location stored, he clicks a link which then performs the search. His values are as follows.. Job = developer, Salary = 10K, Location = uk I want to search the Jobs table and match it with the above, this part I can do. The next stage is if it doesn`t find any matches it then finds the nearest. So if the only record I have in the Jobs table is as follows Job = developer, Salary = none, Location = uk How do I go about making it pick up the nearest. At the moment I am using SELECT * FROM Jobs where Job='$Job' and Salary='$Salary' and Location='$Location' So obviously it won`t match them, anyone wake me up from my slumber and help me out with this? Cheers Ade

« previous php.general (#42624) next »