Maison  >  Article  >  développement back-end  >  MySQL where 条件替换疑问?

MySQL where 条件替换疑问?

WBOY
WBOYoriginal
2016-08-18 09:15:371137parcourir

字段:ariclecategory/index?type=article

值 :ariclecategory/index

需求:比较?之前的自读内容和值是否相等

想每次查询的时候,将包括问好在内的内容给去除掉在比较,请问怎么写where?

目前:select * from where ziduan = 'ariclecategory/index';

回复内容:

字段:ariclecategory/index?type=article

值 :ariclecategory/index

需求:比较?之前的自读内容和值是否相等

想每次查询的时候,将包括问好在内的内容给去除掉在比较,请问怎么写where?

目前:select * from where ziduan = 'ariclecategory/index';

<code>select * from where ziduan like 'ariclecategory/index%'</code>

ariclecategory/index 如果是变量,请使用变量替换
前缀匹配的like是可以用索引的。后缀匹配和模糊匹配不可以。

select * from where ziduan like 'ariclecategory/index%' ?没懂啥意思

去掉问号这种数据处理的事情是要放在程序中进行的,sql的where就按你现在这么写的就行

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn