我正在使用unionall函数来获取多个查询的组合结果,但我得到重复的数据, 示例示例:
select expand($res) let $a = (select from #3:1) , $b = (select from #3:1) , $res = unionall($a,$b)
我得到重复的数据,
甚至尝试通过查询摆脱,但仍然是相同的结果
select $res let $a = (select rid from #3:1) , $b = (select rid from #3:1) ,$res = unionall($a,$b)
我如何获得独特的价值观?
答案 0 :(得分:1)
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)) )
请注意"选择摆脱#3:1"与"选择@rid从#3:1"完全不同,反过来与"选择#3:1"。
答案 1 :(得分:0)
尝试此查询
select expand($res) let $a = (select from #3:1) , $b = (select from #3:1) , $res = intersect($a,$b)
我用union替换了unionall。