Re: SQL Select statement
| From: | Lennin Arriola | Date: | Mon, 19 Feb 2001 16:39:50 +0000 |
| Subject: | Re: SQL Select statement | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-6740@lists.php.net to get a copy of this message | ||
> 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)
>
Exactly, keep several rows for choices,
have two tables
members choices
-----------------------
choiceid
id memberid
name choice
whatever
for instance if somebody (member 21) chooses 2 and 3
there must be in the choices table
choiceid memberid choice
1 21 2
2 21 3
then your sql statement will work.
(* you might still add another field in case for instance there are several
votaciones...)
Lennin Arriola
lennin@conexion.com