【发布时间】:2017-08-02 17:17:32
【问题描述】:
我需要一个 sql 查询来使用 mysql 匹配 (index:fulltext) 来提取所有相关的“网球礼物”产品,但是在使用 substring_index 仅从 product_attributes 中获取类别部分以匹配 @987654321 时出现以下错误@字符串
product_attributes value = {"category":"Tennis > Gifts > Necklace", "seasons":{"months":["January","February"]}}
select product_code
from products
where match(substring_index(substring_index(product_attributes, 'category', -1), '"', 1)) against ('Tennis Gifts' IN NATURAL LANGUAGE MODE)
错误
#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 3 行的 '(substring_index(product_attributes, 'category', -1), '"', 1)) ' 附近使用正确的语法
如何仅将类别值与搜索词匹配,感谢任何帮助。提前致谢。
【问题讨论】:
-
这个问题根本没有PHP。
php标签无关紧要。