时间:2021-07-01 10:21:17 帮助过:13人阅读
SELECT * FROM table WHERE FIND_IN_SET('2',cid);
------解决方案--------------------
mysql> select find_in_set(2, "2,3,4");
+-------------------------+
| find_in_set(2, "2,3,4") |
+-------------------------+
| 1 |
+-------------------------+
1 row in set (0.00 sec)
mysql> select find_in_set(2, "52,3,4");
+--------------------------+
| find_in_set(2, "52,3,4") |
+--------------------------+
| 0 |
+--------------------------+
1 row in set (0.00 sec)
mysql> select find_in_set(2, "2,3,4");
+-------------------------+
| find_in_set(2, "2,3,4") |
+-------------------------+
| 1 |
+-------------------------+
1 row in set (0.00 sec)