2013-03-04 100 views
0

使用SphinxQl,而执行这个查询,我收到以下错误sphinxQl获得查询日志

select fieldname from indexname where height >= 165.25 and height <= 175.25 OR Age >=51; 
ERROR 1064 (42000): sphinxql: syntax error, unexpected OR, expecting $end near 'OR Age >=51' 

select fieldname from indexname where (height >= 165.25 and height <= 175.25) OR Age >=51; 

ERROR 1064 (42000): sphinxql: only >=, <=, and BETWEEN floating-point filter types are supported in this version near '(height >= 165.25 and height <= 175.25) OR Age >=51' 

先感谢,请建议

+0

'OR'在SphinxQL中不受支持 – 2013-03-04 12:27:15

+0

对于这种情况,如何在sphinxQL中进行查询?请告知 – karthik 2013-03-04 13:03:16

+0

这没有好的解决方案。你唯一能做的就是向Sphinx发起两次查询,并且自己将它们加入代码中 – 2013-03-05 10:16:31

回答

1

试着这么做

SELECT fieldname, IF((height >= 165.25 AND height <= 175.25) OR Age >=51, 1, 0) 
AS myfilter FROM indexname WHERE myfilter = 1 

狮身人面像可以做'或',他们实际上不能在WHERE子句本身。