Home  >  Article  >  Backend Development  >  下,mysql语句的疑问?提供具体的思路

下,mysql语句的疑问?提供具体的思路

WBOY
WBOYOriginal
2016-06-13 10:05:42906browse

高手指点下,mysql语句的疑问?提供具体的思路?
数据库里面存在一字段 如strvalue(varchar) 其保存的值类似:1,2,5,7 或1,2,8,9 这样


1、现在从网页上获取到值 为1 或9不定,

  写个select 语句查询出 数据库中满足1,或5 的行。。。

   好像用like 不行,用一句可以实现吗?
2、要是从网页上(复选框得到的)获取到值 为1,2或8,9不定,

  写个select 语句查询出 数据库中满足1,2,或8,9 的行。。。

------解决方案--------------------
where strvalue link '%1%' or strvalue link '%5%'
------解决方案--------------------
做成全文索引
------解决方案--------------------

SQL code
where strvalue like '1,2%' or strvalue like '%8,9'<div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn