select  * from 表1 where '[1],[101],[102],[103],[10101],[10102],[10201],[10202]' like '%[10101]%,%[10201]%'
想要的效果是如果like前面的字符串中有含有字符串[10101]或字符串[10201]中的任意一个就返回结果集
怎么样连起来写能实现这种效果?

解决方案 »

  1.   

    select * from 表1 where '[1],[101],[102],[103],[10101],[10102],[10201],[10202]' 
    regexp '[10101]|[10201]'
      

  2.   

    select * from 表1 where
    find_in_set('[10101]','[1],[101],[102],[103],[10101],[10102],[10201],[10202]')>0 or
    find_in_set('[10201]','[1],[101],[102],[103],[10101],[10102],[10201],[10202]')>0;