The table has rows with values:
How can I find all the rows where in the ids column there is an integer "1", so that, in this case, the output is the string c id 1.
The table has rows with values:
How can I find all the rows where in the ids column there is an integer "1", so that, in this case, the output is the string c id 1.
select * from table where find_in_set(1,ids)>0 BUT I strongly recommend changing the structure of the base and bringing it to Normal form . Those. create another table in which there will be separate records with id from the first table and one of the values from the list. Because searching in lists, separated by commas, for relational databases is non-trivial and cannot be optimized (with any query, all records in the database are scanned)
If I understand your question correctly, then:
select * from table where ids like '%,1,%' or ids like '%,1' or ids like '1,%' select * from table where a=1 or b=1 or c=1 Source: https://ru.stackoverflow.com/questions/532311/
All Articles