mysql - 不用 REGEXP 和 LIKE 如何进行 sql 模糊查询
大家讲道理
大家讲道理 2017-04-17 13:56:47
0
1
477

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

select * from item nick = 'aaaa' where item_title = '护膜'....
大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
刘奇

INSTR (field name, string)
Returns the position of the string in the content of a certain field. If the string is not found, it returns 0, otherwise it returns the position (starting from 1)
-- for example
SELECT * FROM item where INSTR(item_title , 'protective film' ) > 0
-- instr N
select * from
(select id, instr('protective film,'Dabao',' Hand Cream',',item_title +',') as d from
item where item_title in ('Protective Film','Dabao','Hand Cream') order by d) as t;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template