0

So I have a MySQL field with content like this "1,2,3" or "1,6" or just "6". Either a single number, or a comma list.

What I want to do, is a query to find where that field contains say "2", or 2 and 6. It would have to be them exactly, so I don't think I can use LOCATE since that would find the first occurrence, not the exact input.

Is there an actual way to do what I want directly in the MySQL query?

I can easily do it in PHP by directly comparing, but I don't want to pull all the rows from the DB to do that.

NaughtySquid
  • 1,947
  • 3
  • 29
  • 44

0 Answers0