Ah, I see what you mean, I misunderstood before. In this case, I would tend to reevaluate my table structure since you're inherently giving a key (colorID) more than one possible value (1 or 2) at the same time. There could be something you could do with DISTINCT but I can't think exactly how you'd do this with a SQL query, short of using 'n' joins.

Of course if it's possible, it'd be best to modify the table such that you separate colorID into two columns, and then use an AND.

-Fred

danchik wrote:
thats effectively an OR statement, isnt it?

how would i select the itemsIDs that have all the requested colors?

for example if data was:
id    :    colorID    :    itemID
-----------------------------
1            1                  1
2            1                  2
3            1                  3
4            2                  1
5            2                  4

and i want the ones that are of color 1 AND 2 i should get back
itemID
1

(since its the only one with both specified colors)


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to