【问题标题】:Filtering sphinxql group by query by count按计数按查询过滤 sphinxql 组
【发布时间】:2014-03-12 03:16:27
【问题描述】:

有人知道如何按计数过滤 sphinxql 组吗? 例如我有这样的查询:

SELECT collection_id, count(*) as cnt 
FROM mobile_content 
WHERE collection_id != 0 
GROUP BY collection_id

而且我只想获取 cnt 大于 5 的行。如果我做这样的事情,我会得到一个错误:

SELECT collection_id, count(*) 
FROM mobile_content 
WHERE collection_id != 0 AND count(*) > 5 
GROUP BY collection_id;

ERROR 1064 (42000): sphinxql: Aggregates in 'where' clause prohibited near '5 GROUP BY collection_id'

我记得在旧版本中,我使用 @count 按结果过滤分组。

我当前的 sphinxsearch 版本是 2.1.5。在这个版本中是否可以按计数过滤结果?

【问题讨论】:

    标签: select count where sphinx sphinxql


    【解决方案1】:

    我当前的 sphinxsearch 版本是 2.1.5。在这个版本中是否可以按计数过滤结果?

    没有。

    HAVING 子句,在 2.2.1-beta 中添加

    http://sphinxsearch.com/docs/current.html#sphinxql-select

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-06
      • 1970-01-01
      • 1970-01-01
      • 2016-03-11
      • 1970-01-01
      相关资源
      最近更新 更多