1

I have one column named services_id.

The column contain comma separated values like 1,3,4,5.

Now I want to search based on condition that if services_id = 3 all row that contain 3 should come up in result whether it has value like 1,3,4,5 OR 3,4,5,1.

I have tried with IN operator but it gives only value which comes at first index.

like if I searched with services_id IN (3) it return only column with value 3,4,5,1 which have 3 in its first index. It should return column which have 3 in any index.

In this case result should be two row

1,3,4,5 AND 3,4,5,1

Nikita
  • 11
  • 2
  • Yes !! you can execute below query `select * from YOURTABLENAME where CONCAT(',', YOURCOLUMNNAME, ',') like '%,1,%'` – Meet Patel Jan 18 '20 at 07:30
  • See also: https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad – Strawberry Jan 18 '20 at 09:51

0 Answers0