字段名为test,数据如上,
需要筛选字段有3的数据
一般的查询为 select * from table where test like '%3%'
但是考虑到可能会出现13,1,的情况
select * from table where CONCAT(",",test ",") LIKE "%,3,%"
CONCAT的的作用是拼接,先把前面的,补上以防万一
字段名为test,数据如上,
需要筛选字段有3的数据
一般的查询为 select * from table where test like '%3%'
但是考虑到可能会出现13,1,的情况
select * from table where CONCAT(",",test ",") LIKE "%,3,%"
CONCAT的的作用是拼接,先把前面的,补上以防万一