SELECT with two (or one) of the three fields - probably with loads of OR's
after the intial search returns 0  rows.

Messy maybe but I don't see any other way.

You can't use a SELECT like you are currently using with fields of the same
name in different tables - I'm surprised you are not throwing an error at
this point unless you are using a web interface that is not error checking.

Andy





----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 05, 2001 10:04 AM
Subject: 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
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to