这是我的查询:
SELECT
store_id as `initial`,
CONCAT(',', store_id, ',') AS store_id
FROM `mytable` AS `main_table`
WHERE (`store_id` LIKE '%,13,%');
这些是没有 where
条件的结果:
当我执行查询时,没有得到任何结果。与 WHERE (
store_idLIKE '%,3,%');
相同,这是 、
和 的某种规则或异常(exception)吗>like
运算符?
谢谢:)
最佳答案
使用 FIND_IN_SET 解决了我的问题。更多信息: https://www.w3resource.com/mysql/string-functions/mysql-find_in_set-function.php .
感谢@Jens
SELECT
store_id as `store_id`,
FROM `ffm_nonpayment_actiontemplate` AS `main_table`
WHERE FIND_IN_SET('13', store_id);
关于mysql - 在 MySQL 中使用 LIKE 运算符和逗号问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49357925/