teg*_*goo 1 sql nosql graph-databases orientdb
我有以下输出
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).
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?(不同值的计数与该值的选择不匹配。实际上db中有4个不同值)
更新[WTF]
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).
Run Code Online (Sandbox Code Playgroud)
小智 5
尝试这个:select distinct(pos) from Synset limit-1
控制台和工作室会limit 20自动添加。因此,当您执行时select distinct(pos) from Synset,实际上返回前20行中的不同值。
现在这select * from (select distinct(pos) from Synset)将返回预期结果,因为内部查询没有限制,只有父查询的限制为20,但只有4个结果。