How does one order results for a MySQL Query by how well they matched a given query.
Use the following ORDER rule
ORDER
BY case when `ColumnName` LIKE 'FirstRelevance' then 1 else 0 end
+ case when `ColumnName` LIKE 'SecondRelevance' then 1 else 0 end
+ case when `ColumnName` LIKE 'ThirdRelevance' then 1 else 0 end
...
DESC
No comments:
Post a Comment