Orientdb unionall函数返回重复数据
我使用unionall函数来获得多个查询的组合结果,但我得到了重复的数据, 示例:Orientdb unionall函数返回重复数据,orientdb,Orientdb,我使用unionall函数来获得多个查询的组合结果,但我得到了重复的数据, 示例: select expand($res) let $a = (select from #3:1) , $b = (select from #3:1) , $res = unionall($a,$b) 我得到了重复的数据 即使通过查询rid进行了尝试,但结果仍然相同 select $res let $a = (select rid from #3:1) , $b = (select rid from #3:1) ,
select expand($res) let $a = (select from #3:1) , $b = (select from #3:1) , $res = unionall($a,$b)
我得到了重复的数据
即使通过查询rid进行了尝试,但结果仍然相同
select $res let $a = (select rid from #3:1) , $b = (select rid from #3:1) ,$res = unionall($a,$b)
如何获得唯一值
select distinct(@this)
from (select expand($u) as res
from (select $u
let $a = (select from #3:1),
$b = (select from #3:1),
$u = unionall($a,$b)) )
请注意,select rid from 3:1与select@rid from 3:1完全不同,后者又不同于select from 3:1。尝试此查询
select expand($res) let $a = (select from #3:1) , $b = (select from #3:1) , $res = intersect($a,$b)
我用intersect替换了unionall。谢谢你,但是如何从上面的查询中获得比jus rid更完整的文档呢?使用expand,即替换distinct@this通过expanddistinct@this.Not令人惊讶的是,intersect给出的是集合论的交集,而不是并集。例如:>select expanddistinct$u让$a=select from 11:0,$b=select from[11:0,11:1],u=intersect$a,$b给出11:0,但select expanddistinct$u让$a=select from 11:0,$b=select from[11:0,11:1],u=unionall$a,$b给出11:0 11:0