T
T
tigra2018-03-01 15:30:16
PHP
tigra, 2018-03-01 15:30:16

How to count the total number of records in Sphinx with grouping?

There is a request like

SELECT *, COUNT(group_id) as countByGroup FROM table GROUP BY group_id

in the sphinx everything works correctly
when I pass the request to the ActiveDataProvider, it tries to calculate the total number in this way
SELECT COUNT(*) FROM (SELECT *, COUNT(group_id) as countByGroup FROM table GROUP BY group_id)
and I get an error: "Syntax error or access violation: 1064 sphinxql: outer select list must be a single star near '(SELECT *, COUNT(*)........."
so the question is simple: how to count the total number of all records from a query with grouping in Spinxql?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
ivankomolin, 2018-03-01
@ivankomolin

Apparently you are somehow incorrectly passing the request to the ActiveDataProvider

M
ManticoreSearch, 2018-04-08
@ManticoreSearch

SELECT COUNT(DISTINCT group_id) FROM table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question