Search code examples
selectcountwhere-clausesphinxsphinxql

Filtering sphinxql group by query by count


Does anybody know how filter sphinxql group by query by count? For example I have query like:

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

And I want to take to result only rows that have cnt greater than 5. If I make something like this, I get an error:

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'

I remember that in older versions I used @count to filtering group by results.

My current sphinxsearch version is 2.1.5. Is it possible to filter results by count in this version?


Solution

  • My current sphinxsearch version is 2.1.5. Is it possible to filter results by count in this version?

    No.

    The HAVING clause, was added in 2.2.1-beta

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