SQL Select statement
| From: | bill | Date: | Sat, 17 Feb 2001 01:44:56 +0000 |
| Subject: | SQL Select statement | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6706@lists.php.net to get a copy of this message | ||
I have a table with three simple columns: id(unique), memberID, and
choice
I want to find out which memberIDs have BOTH choice 2 AND choice 3.
--> SELECT memberID from table where choice=2 AND choice = 3
That won't work (0 results, of course, because no row has two choices,
they're mutually exclusive)
---> SELECT memberID from table where choice=2 OR choice = 3
That doesn't work (shows all memberIDs that chose either 2 or 3).
Can I maybe join the table upon itself on the memberID?
Other suggestions?
thanks,
bill hollett