Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Distinct SphinxSE不同的空结果_Distinct_Sphinx - Fatal编程技术网

Distinct SphinxSE不同的空结果

Distinct SphinxSE不同的空结果,distinct,sphinx,Distinct,Sphinx,我在sphinx se控制台中运行此查询: SELECT @distinct FROM all_ips GROUP BY ip1; 我得到这个结果: +------+--------+ | id | weight | +------+--------+ | 1 | 1 | | 2 | 1 | | 3 | 1 | | 9 | 1 | | 15 | 1 | | 16 | 1 | | 17 |

我在sphinx se控制台中运行此查询:

SELECT @distinct FROM all_ips GROUP BY ip1;
我得到这个结果:

+------+--------+
| id   | weight |
+------+--------+
|    1 |      1 |
|    2 |      1 |
|    3 |      1 |
|    9 |      1 |
|   15 |      1 |
|   16 |      1 |
|   17 |      1 |
|   20 |      1 |
|   21 |      1 |
|   25 |      1 |
|   26 |      1 |
|   27 |      1 |
|   31 |      1 |
|   32 |      1 |
|   38 |      1 |
|   39 |      1 |
|   40 |      1 |
|   46 |      1 |
|   50 |      1 |
|   51 |      1 |
+------+--------+
20 rows in set (0.57 sec)
如何获取唯一值的数量?为什么@distinct column没有出现在结果中?

1)我认为这不是sphinxSE-你真的是指sphinxQL吗?这看起来更像狮身人面像


2) 什么栏目?您需要向sphinx出售您想要在其中计算不同值的属性。在sphinxQL中,使用COUNT(不同的列名称)

您需要简单的SQL语句来获取COUNT。像这样的

SELECT count(ip1),ip1 
FROM all_ips 
GROUP BY ip1;