View Full Version : using mysql to search for a value in a comma delineated list?
jwocky
07-20-2007, 02:23 AM
I have a table in mysql with comma delineated values, i'm wondering if anyone knows a good strategy to searching for a value inside the comma delineated list across multiple tables?
thanks!
Eikinskjaldi
07-20-2007, 02:30 AM
I have a table in mysql with comma delineated values, i'm wondering if anyone knows a good strategy to searching for a value inside the comma delineated list across multiple tables?
thanks!
Not entirely sure what "across multiple tables" means. You can use find_in_set to search a list for a value
select blah from table where find_in_set(value, comma_list_field)
It does an ALL table scan and is thus inefficient, and should only be used when you have a very small table or where clauses that limit the scan to a small range.
jwocky
07-21-2007, 02:07 PM
Thanks! thats EXACTLY what I needed. Much much appreciated :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.