Reputation: 10162
data structure of the table is like that
ID ids
--- ----
2 3432,545,65454
3 654,3333223,54333
4 547432
I want to find a row for example which has 545, what kinda query should i write? maybe find_in_set can help me?
Upvotes: 3
Views: 70
Reputation: 6032
Yes, FIND_IN_SET in one way.
Another way is
select * from tablename
where ids like '545'
OR ids like '545,%'
OR ids like '%,545'
OR ids like '%,545,%'
Upvotes: 0
Reputation: 838116
Yes, you can use FIND_IN_SET
:
SELECT ID, ids
FROM yourtable
WHERE FIND_IN_SET('545', ids)
Upvotes: 4