[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about IN operator


I have a field (cdfeature) that contains a list of comma seperated values.
Example follows:

select item_id, cdfeature from cars where (101 in (cdfeature));
+---------+---------------------+
| item_id | cdfeature           |
+---------+---------------------+
|     320 | 101,104,106         |
|     321 | 101,103,105,112     |
|     323 | 101,103,105,112     |
|     316 | 101,102,104,108,112 |
|     345 | 101,102,104,108,112 |
+---------+---------------------+

When I select only one value (ie, 101) the statement works. I need to be
able to select based upon multinple IN statements. When I try this, the
query returns an empty set. Example follows:

select item_id, cdfeature from cars where (101 in (cdfeature)) and (112 in
(cdfeature));
Empty set (0.00 sec)

The above query should have, I think, returned records that had BOTH a 101
an a 112 in the cdfeature filed. Specifically, it should have returned
records 321, 323, 316, 345. Somebody please help me out here!!!

	Don!


---------------------------------------------------------------------
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 <suppressed>
To unsubscribe, e-mail <suppressed>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.