Hello everyone. I am in a real bind. I am trying to get a list of names
from a table where for each name there are several specific entries.
For example, the table looks like this:
ContactID
FactName
Value
for each ContactID, there may be several entries with different fact/values
such as hair=red, eyes=blue, married=yes and so on.
So if I want to get a list of all contactid who has 1 child and is married,
I would think I should do this:
SELECT * FROM contact INNER JOIN fact ON fact.contactid=contact.contactid
WHERE (fact.factname='married' AND fact.value='yes') AND
(fact.factname='children' AND fact.value='1')
This will not work. As soon as I add the AND in the middle, it dies. If I
use an OR it works, but that is not what I want.
What can I do?
Glenn Thimmes
Software Engineer
TransLux West
1651 N. 1000 W.
Logan, UT 84321
435.716.8675
---------------------------------------------------------------------
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