select * from A where find_in_set(171,name) > 0

解决方案 »

  1.   


    select * from A where name like '%171%'
      

  2.   

    select * from A where find_in_set(171,name) 
      

  3.   

    确定使用 find_in_set 能行吗?
      

  4.   


    select * from A where name like '%171%' 3楼的方法有局限性,如果存在这样的name值得时候怎么办呢,比如
    ID    name
    1     171,172,173
    2     172,1713
    3     1712
    4     170,1712
    5      171,174
    那你岂不都查出来了?很显然不行,当然采用存储过程的话肯定能解决,当然希望一条SQL语句解决就更好了,期待中......