如何使用或条件编写sphinx查询
我需要在项目中使用或条件创建sphinx查询。但是给出一个或类似的条件如何使用或条件编写sphinx查询,sphinx,Sphinx,我需要在项目中使用或条件创建sphinx查询。但是给出一个或类似的条件 select cost FROM transactionsChart WHERE cost=25 OR cost=5; 它不起作用。它返回一个错误,如 ERROR 1064 (42000): sphinxql: syntax error, unexpected OR, expecting $end near 'OR cost=5' 谁能帮我 提前感谢尝试 select cost FROM transactionsChar
select cost FROM transactionsChart WHERE cost=25 OR cost=5;
它不起作用。它返回一个错误,如
ERROR 1064 (42000): sphinxql: syntax error, unexpected OR, expecting $end near 'OR cost=5'
谁能帮我
提前感谢尝试
select cost FROM transactionsChart WHERE cost=25 | cost=5;
斯芬克斯不支持WHERE子句中的
或,只支持和
对于您的特定示例,可以在
语法中使用
sphinxql> SELECT cost FROM transactionsChart WHERE cost IN (5,25);
或者更一般的解决方案是使用虚拟属性
sphinxql> SELECT cost, IF(cost=25 OR cost=5,1,0) AS filter
FROM transactionsChart WHERE filter = 1;
不,那不行。您链接到的文档用于扩展语法,这是MATCH(…)
子句中理解的全文语法,它不适用于WHERE子句的其余部分。