mysql statement: two tables, two comparisons
| From: | Jason End | Date: | Thu, 06 Mar 2003 13:52:12 +0000 |
| Subject: | mysql statement: two tables, two comparisons | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26119@lists.php.net to get a copy of this message | ||
I'm looking for a mysql select statement that does the
following:
- Check if the value of each expert.id on the table
experts matches a value expt.id in the table
apliexpert.
- For those values where this is true check whether
the softID value for that row matches the variable
$softId.
- return the names that are left after those 2 filters
So for tables:
Expert
id Name
1 Peter
2 Paul
3 Mary
4 Frank
Apliexpert
exptid softid
1 3
2 5
2 8
3 9
3 8
1. If the softID is 2, the select should return:
peter, paul, mary and frank (frank will always be
returned no matter what, because he isn't in
apliexpert)
2. If the softID is 3, the select should return: paul,
mary and frank
3. If the softID is 8, the select should return: peter
and frank
4. If the softID is 9, the select should return:
peter, paul and frank
J
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com