select * from tb where charindex(',11,' , ','+列+',') > 0

解决方案 »

  1.   

    select * from tbl where col like '%[^1]11[^1]%'
      

  2.   

    包含11的都要 不包含11 包含8111或711或118这样的都不要
    什么意思呢?select * from tbl where col like '%11%'
     
      

  3.   

    create table tb(col varchar(50))
    insert into tb values('1,11,8111,711,118')
    insert into tb values('1,8111,711,118')
    insert into tb values('1,8111,711,118')
    insert into tb values('1,711,118')
    insert into tb values('1,118')
    insert into tb values('1,711,118')
    goselect * from tb where charindex(',11,' , ','+ col +',') > 0
    /*
    col                                                
    -------------------------------------------------- 
    1,11,8111,711,118(所影响的行数为 1 行)
    */select * from tb where ','+ col +',' like '%,11,%'
    /*
    col                                                
    -------------------------------------------------- 
    1,11,8111,711,118(所影响的行数为 1 行)
    */
    drop table tb