SQL

Mysql 多个关键字like 按照匹配最多排序

SELECT * FROM `hy_thread` WHERE?

`title` LIKE '%关键字1%' OR `title` LIKE '%关键字2%' OR `title` LIKE '%关键字3%' OR `title` LIKE '%关键字4%'?

ORDER BY ((CASE WHEN `title` LIKE '%关键字1%' then 3 else 0 end)+(CASE WHEN `title` LIKE '%关键字2%' then 1 else 0 end)) DESC LIMIT 0, 4


0 条评论

发表评论

你需要登录后才可进行发表