mysql - sphinx 在 group by 中有两个参数

标签 mysql linux sphinx

我如何在 Sphinx 中对多个属性进行 GROUP BY

    sphinx.conf

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

例子:

    SELECT 
            * 
    FROM 
            some_table
    GROUP BY 
            brand_id, resource_id

sphinx 告诉我:

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

最佳答案

创建一个虚拟属性。例如。

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

只需让 100000 大于您的最高 resource_id

关于mysql - sphinx 在 group by 中有两个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11579878/

相关文章:

php - 按名称排序,但忽略引号?

c - 后台进程和挂起进程 - 在 C 中实现作业控制 Shell

c - Linux C套接字错误: Input/output error

mysql - 在 mySQL 数据库上创建搜索

php - Sphinx 从 linux 控制台运行正常,但不是从 php api

php - 抑制 php 上的 mysql 错误

c# - 如何为包含数据库连接器的程序集设置绝对路径?带有 Entity Framework 4.1 的 MySQL 连接器 6.4.3

MYSQL 选择优先级数据(如果存在)

linux - 查看linux下当前设置的JAVA_OPTS

php - 浏览忽略 max_matches 的 Sphinx 结果?