Addressed to: "JJeffman" <[EMAIL PROTECTED]>
              "PHPDB" <[EMAIL PROTECTED]>
              "bill" <[EMAIL PROTECTED]>

** Reply to note from "JJeffman" <[EMAIL PROTECTED]> Sat, 17 Feb 2001 13:11:20 
> Try this way :
> "select t1.memberID,t1.choice,t2.memberID, t2.choice from table as t1, table
> as t2 where t1.choice = 2 and t2.choice =3"
> It works, but you'll going to have as many records as the  bigger number of
> records between choice=2 and choice = 3, no matter you use the distinct
> keyword or not. I
> think you can give your problem another approach, splitting it in two
> queries and joining the result sets through php script.
> Sometimes you can't put SQL to do all the work.

Not all that often though...   :)

   SELECT t1.memberID
   FROM Table AS t1, Table AS t2
   WHERE t1.MemberID = t2.MemberID
     AND t1.Choice = 2
     AND t2.Choice = 3;

Unless you have more than one entry for a member of choice 2 or choice 3
this will give you a list of memberIDs which have both choice 2 and
choice 3 records.  If you find you have duplicate memberIDs, you can add
a DISTINCT clause to the select.

> > 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.

Rick Widmer
Internet Marketing Specialists

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to