目前使用原生查询解决
SELECT * FROM table WHERE CONCAT(",", `cate`, ",") REGEXP ",(1|2|3),"
/*****************************/
常用的比如
where('id','in',[1,2,3])
但是当这个字段是逗号(,)分割的字符串时怎么实现呢
id cate
1 1,2,3
2 1,5,6
目的查出(cate in 1,2,3,4,5,6)的记录
where('cate','in',[1,2,3,4,5,6])
这样写结果不对
find_in_set 只能查cate包含3的,不是我想要的结果,
select * from A where find_in_set('3', ‘cate’);
大神有方法吗
最佳答案
