首页 > MySQL where 条件替换疑问?

MySQL where 条件替换疑问?

字段:ariclecategory/index?type=article

值 :ariclecategory/index

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

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

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


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


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


select * from where ziduan like 'ariclecategory/index%'

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

【热门文章】
【热门文章】