Sql 定向不正确
我有以下输出Sql 定向不正确,sql,orientdb,graph-databases,nosql,Sql,Orientdb,Graph Databases,Nosql,我有以下输出 orientdb {db=dict}> select count(distinct(pos)) from Synset; ----+------+----- # |@CLASS|count ----+------+----- 0 |null |4 ----+------+----- 1 item(s) found. Query executed in 2.514 sec(s). orientdb {db=dict}> select distinct
orientdb {db=dict}> select count(distinct(pos)) from Synset;
----+------+-----
# |@CLASS|count
----+------+-----
0 |null |4
----+------+-----
1 item(s) found. Query executed in 2.514 sec(s).
orientdb {db=dict}> select distinct(pos) from Synset;
----+------+--------
# |@CLASS|distinct
----+------+--------
0 |null |n
----+------+--------
1 item(s) found. Query executed in 0.012 sec(s).
我做错了什么?
不同值的计数与此值的选择不匹配。实际上,db中有4个不同的值
更新[WTF]
尝试以下操作:从Synset limit-1中选择distinctpos
控制台和studio会自动添加限制20。因此,当您从Synset执行selectdistinctpos时,实际上返回了前20行的不同值
现在,此select*from select distinctpos from Synset返回预期结果,因为内部查询没有限制,只有父查询限制为20,但只有4个结果。尝试以下操作:select distinctpos from Synset limit-1
控制台和studio会自动添加限制20。因此,当您从Synset执行selectdistinctpos时,实际上返回了前20行的不同值
现在,这个select*from select distinctpos from Synset返回预期结果,因为内部查询没有限制,只有父查询限制为20,但只有4个结果。非常感谢您的回答。现在我明白了。非常感谢你的回答。现在我明白了。
orientdb {db=dict}> select * from (select distinct(pos) from Synset)
----+------+--------
# |@CLASS|distinct
----+------+--------
0 |null |n
1 |null |v
2 |null |a
3 |null |r
----+------+--------
4 item(s) found. Query executed in 2.722 sec(s).