>Bob Hall wrote:
>  >
>  > >I want to do a select like
>  > >
>  > >select id from test
>  > >where id in (select id from test where value in (1,2,3)
>  > >and id in (select id from test where value in (4,6,7)
>  > >and id in (select id from test where value in (1,6,25)
>  >
>  > Even if MySQL supported subqueries, this query would always return
>  > the empty set. I'm really unsure about what you're trying to do, but
>  > I think the following comes close.
>  >     SELECT id
>  >     FROM test
>  >     WHERE value IN (1, 2, 3, 4, 6, 7, 25);
>  >
>
>
>No the query I wrote would return the intersection of three
>lists of user ids where each list contained any users that
>had the values listed.

Usually, the column name 'id' is used for a unique row identifier. 
Since you didn't give the table structure, I assumed that was the 
case here. If not, then your query could return rows. In that case, 
your temp table approach is probably the best solution.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak

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

Reply via email to