I'm trying to search an array in the database...
One of my fields has something like this:
1,2,22,224
So if I do:
WHERE Value LIKE '%2%'
It will return: 2,22,224
If I do:
WHERE Value = '2'
It will return nothing...
How can I just get '2' ?
where value like '%,2,%'
Good try but that will not work in every case....
In this case there is no comma before the 2...
where value like '2,%' or value like '%,2,%'
I understand what you are trying to do...
It was an awesome try...
However sometimes, it's just '2' in the column with out an array...
If you're storing an array in a database, then you may have a serious database design problem. The array data should be farmed out to a seperate table (match it by ID). Then your searches will be a lot easier.
yeah I know...