0
+----+-------+-------------+
| id | ids   | other_data |
+----+-------+------------+
|  1 | 1,2,3 | some data  |
|  2 | 1,2   | some data  |
|  3 | 2     | some data  |
|  4 | 6     | some data  |
+----+-------+------------+

following command retrieves first and second row and first argument for find_in_set is an integer :

SELECT * FROM my_table WHERE FIND_IN_SET(1,ids);

What if I want to send multiple ids as first argument? for example something like:

SELECT * FROM my_table WHERE FIND_IN_SET('1,2',ids);

I need to retrieve rows containing 1 or 2 in their ids list.

eylay
  • 1,712
  • 4
  • 30
  • 54
  • 1
    "What if I want to send multiple ids as first argument?" You need to use `..WHERE FIND_IN_SET(1, ids) OR FIND_IN_SET(2, ids)` – Raymond Nijland Jun 02 '18 at 11:07
  • 1
    The best solution is to normalize the column id's then you can use the `IN` clause like so `IN(1, 2)` But you also need to use a JOIN. – Raymond Nijland Jun 02 '18 at 11:09

0 Answers0