像图片中这样,可以根据symptom列中的部分字符串查询吗,如果我想得到同时含有symptom列同时含有70,72的id,该如何做呢,请大家指教

解决方案 »

  1.   

    SELECT * FROM TABLENAME WHERE ','+symptom+',' LIKE '%,72,%' and ','+symptom+',' LIKE '%,70,%'
      

  2.   

    搞错数据库
    SELECT * FROM TABLENAME WHERE CONCAT(',',symptom+,',') LIKE '%,72,%' and CONCAT(',',symptom+,',') LIKE '%,70,%'
      

  3.   

    select * 
    from 像图片中这样
    where find_in_set(70,symptom)
    and find_in_set(72,symptom)
      

  4.   

    3楼 太棒了 find_in_set()函数可以实现的,非常感谢!
      

  5.   

    2楼 您好,SQL语句我拿来用出现错误,后来把symptom后的+去掉后查询成功了,也非常感谢
      

  6.   

    我想请问一下symptom这一字段类型用varchar型还是别的什么类型啊?