SELECT * FROM TABLE_NAME WHERE 'string' in ('string1','string2','string3')
Its not given correct result find_in_set only given a exact result. If any way to get correct result without using find_in_set
SELECT * FROM TABLE_NAME WHERE 'string' in ('string1','string2','string3')
Its not given correct result find_in_set only given a exact result. If any way to get correct result without using find_in_set
SELECT * FROM TABLE_NAME WHERE 'string' in ('string1','string2','string3');
In the above query, string
is supposed to be a field (column) so, if you were to have this query work, it would be without single quotes '
, like this:
SELECT * FROM TABLE_NAME WHERE string IN ('string1','string2','string3');
This will return all rows where the field string
is exactly string1
or string2
or string3
.
Now, if you want to query the field string
for values like "string", not exactly matching, then you use the LIKE operator:
SELECT * FROM TABLE_NAME WHERE string LIKE '%string%';
In the above query, all 3 records containing string1
, string2
and string3
will be returned.