KonstantinKuklin
KonstantinKuklin

Reputation: 317

sphinx with two arguments in group by

How I can GROUP BY in Sphinx for more than one attribute

    sphinx.conf

    sql_attr_uint     = brand_id
    sql_attr_uint     = resource_id
    sql_attr_uint     = is_truck
    sql_attr_uint     = kind

Example:

    SELECT 
            * 
    FROM 
            some_table
    GROUP BY 
            brand_id, resource_id

And sphinx tell me:

    SQLSTATE[42000]: Syntax error or access violation: 1064 sphinxql: syntax error, unexpected ',', expecting $end near ', resource_id

Upvotes: 0

Views: 512

Answers (1)

barryhunter
barryhunter

Reputation: 21091

Create a virtual attribute. For example.

SELECT 
        *, (brand_id*100000)+resource_id as myint
FROM 
        some_table
GROUP BY 
        myint

Just make 100000 be bigger than your highest resource_id

Upvotes: 1

Related Questions