首页 > 不用 REGEXP 和 LIKE 如何进行 sql 模糊查询

不用 REGEXP 和 LIKE 如何进行 sql 模糊查询

求教不用REGEXP,LIKE.
来写模糊查询,假设有1完条数据,搜寻

select * from item nick = 'aaaa' where item_title = '护膜'....

INSTR(字段名, 字符串)
返回字符串在某一个字段的内容中的位置, 没有找到字符串返回0,否则返回位置(从1开始)
-- for example
SELECT * FROM item where INSTR(item_title , '护膜' ) > 0
-- instr N
select * from
(select id, instr('护膜,'大宝','护手霜',',item_title +',') as d from
item where item_title in ('护膜','大宝','护手霜') order by d) as t;

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