日期:2014-05-17  浏览次数:20425 次

mysql如何查询匹配字符串中的多个数字(顺序可颠倒)?
数据表:table

id talent
1 1,2,4,3
2 1,3
3 3,22,13,1
4 11,21,31,13,10,33
5 1,12,13

现在想查询含有1和3的值的行,需要的结果为返回ID:1 2 3共三行。


------解决方案--------------------
select * from table where ',' + talent + ',' like '%,1,%' and ',' + talent + ',' like '%,3,%'