dougongnan2167 2014-12-30 12:32
浏览 21
已采纳

如何在mySQL中的数据库表中搜索逗号分隔的字符串

How to search for a comma-separated string in a database table in mySQL.

Suppose, I have a string in variable $facilities='breakfast,dinner,lunch' and in my database I have a string saved in a field called facilities having values breakfast,dinner,clothing,lunch,hot water.

How do I get the row having values $facilities?

  • 写回答

3条回答 默认 最新

  • drsb77336 2014-12-30 12:38
    关注

    Work like this i hope this is your requirement

    select * from table where field_name like '%$fieldname%' 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?