php - How to return results if more than 60% of string is matching -
i have table product name saved. want execute select query statement 60% or more results matching
for example: if types "verifone 500", product:
1) verifone vx500
2) verifone5
3) verifon00
4) verifone 50"
should matched 60% or more same searched product. have tried code
select `product_name` product_data `product_name` '%verifone 500%'
but not getting desired result.
hope body can help?
you should go fulltext
search myisam
table engine!
if table engine myisam create fulltext index field product_name
.
then try query like:
select `product_name`, match (`product_name`) against ('verifone 500' in natural language mode) match `product_data` having `match` > 0.5 order `match` desc
Comments
Post a Comment