Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top