Re: Match Records
| From: | Richard Lynch | Date: | Sat, 10 Mar 2001 02:01:15 +0000 |
| Subject: | Re: Match Records | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43273@lists.php.net to get a copy of this message | ||
Something like this:
select (job=$job)+(salary=$salary)+(location=$location) as score from blah
order by score desc
Each matching parameter gets a "point", and they add up.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: <Website4S@aol.com>
Newsgroups: php.general
Sent: Monday, March 05, 2001 10:01 AM
Subject: [PHP] Match Records
> 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
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>