gpt4 book ai didi

php - MySQL 匹配搜索中的比较运算符

转载 作者:行者123 更新时间:2023-11-29 22:57:09 28 4
gpt4 key购买 nike

下面是 SQL 语句,我很难放置一个 where 语句来获取匹配生成的分数,并且只返回分数超过 6 的产品。

SELECT product_id, image, title, part_num, price, discount_id, vat, 
MATCH (title,part_num,description)
AGAINST ('SEARCH HERE') AS score
FROM main_products AS p
WHERE status = 1
AND MATCH(title,part_num,description) AGAINST ('SEARCH HERE')
ORDER BY score desc, title ASC

我已经尝试过了,但是这不起作用。它会导致此错误:Documentation #1054 - 'where Clause' 中的未知列 'score'

SELECT product_id, image, title, part_num, price, discount_id, vat, 
MATCH (title,part_num,description)
AGAINST ('SEARCH HERE') AS score
FROM main_products AS p WHERE status = 1 AND score > 6
AND MATCH(title,part_num,description) AGAINST ('SEARCH HERE')
ORDER BY score desc, title ASC

最佳答案

这个怎么样?

SELECT product_id, image, title, part_num, price, discount_id, vat, 
MATCH (title,part_num,description)
AGAINST ('SEARCH HERE') AS score
FROM main_products
WHERE status = 1
AND MATCH(title,part_num,description) AGAINST ('SEARCH HERE')
HAVING score > 6
ORDER BY score desc, title ASC

关于php - MySQL 匹配搜索中的比较运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28675067/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com