比较 Sphinx 中的组

问题描述 投票:0回答:1

此示例在带有 HAVING 的 Sphinx 中不起作用。我收到语法错误。 请解释一下,如何正确比较组?

SELECT someId from rt_index
GROUP BY someId 
HAVING MIN(someId) != MAX(someId)
sphinx
1个回答
0
投票

一般来说,您可以将“表达式”放入

select
子句中,然后可以在
having
中使用它。

SELECT someId,MAX(otherId)-MIN(otherId) AS range FROM rt_index
GROUP BY someId 
HAVING range != 0

我将其更改为使用

MAX(otherId)
,因为按
someId
分组;
MIN(someId)
始终匹配
MAX(someId)

© www.soinside.com 2019 - 2024. All rights reserved.