arunsignit
arunsignit

Reputation: 209

Sphinx Group By for both RT index and plain index

I need to put Group by for Both Rt index and plain index...

For example: I have 4 records with different document ids in plain index with persons of same age..

And also I have 2 records of the same document ids with same age in RT index...

When i'm putting GROUP BY by combining two Index...Grouping count want to remain same for the same document ids that are in the both index... But for me returning Grouping count which are included with the entire count for same document ids too...

     Rt index data: 

     +-----------+------+        
     | id        | age  |
     +-----------+------+
     |         1 |   47 |
     |    123455 |   47 |
     |    123456 |  127 |
     |    123457 |   55 |
     | 101100063 |   51 |

     Plain index..

     +-----------+------+
     | id        | age  |
     +-----------+------+
     | 123455    |   47 |
     | 101100061 |   47 |
     | 111123456 |  127 |
     | 156123457 |   55 |
     | 101100063 |   51 |


    After Grouping Age when combing both i need the result as, need the count by skipping same document ids  


    +-----------+------+----------|
    | id        | age  | Count    |
    +-----------+------+----------|
    | 123455    |   47 | 3        |
    | 101100061 |  127 | 2        |
    | 111123456 |   55 | 1        |
    | 156123457 |   51 | 1        |

Upvotes: 0

Views: 185

Answers (1)

barryhunter
barryhunter

Reputation: 21091

You should be able to use COUNT(DISTINCT id) rather than just COUNT(*) to get the count. (assuming you using sphinxQL of course!)

Upvotes: 1

Related Questions