I wanted to search across multiple lines and get a line containing a specific item.
The table in mySQL is configured so that each identifier has a unique list (comma-delimited) of the values in the row.
Example:
id | order
1 | 1,3,8,19,34,2,38
2 | 4,7,2,190,38
Now, if I wanted to pull out a line containing only number 19, how would I do it? The possibilities that I could see in a list with a LIKE condition would be the following:
19, <-- 19 at the start of the list
,19 <-- 19 at the end of the list
,19, <-- 19 inside the list
I tried the following and I can not get any results, thanks for your help!
SELECT *
FROM categories
WHERE order LIKE '19,%' OR '%,19%' OR '%,19%'
LIMIT 0 , 30
ninu source
share