将查询结果表示为新表

时间:2017-07-31 21:05:59

标签: orientdb orientdb-2.1

我很难构建正确的查询,目前我有两个查询

查询1。

SELECT $TOTAL
LET $CORE = (SELECT FROM SOMETHING_1 WHERE SOMECONDITION_1),
$SOURCE= (SELECT FROM SOMETHING_2 WHERE SOMECONDITION_2),
$TOTAL = UNIONALL($CORE.A , $CORE.B ,$SOURCE.C)

结果我收到: [A1,A2,B1,B2,C1,C2]

查询2.

SELECT $CORE.A , $CORE.B ,$SOURCE.C
LET $CORE = (SELECT FROM SOMETHING_1 WHERE SOMECONDITION_1),
$SOURCE= (SELECT FROM SOMETHING_2 WHERE SOMECONDITION_2)

结果我收到了

**[A1, A2 ],[ B1 , B2] ,[C1 , C2]**

如果我想获得以下结果,我应该使用哪个查询:

  

[A1,B1,C1],[A2,B2,C2]

提前致谢

1 个答案:

答案 0 :(得分:3)

试试这个:

select expand($c)
LET $a = (select creationTime, modificationTime from SOMETHING_1 where SOMECONDITION_1),
$b = (select columns_mail from SOMETHING_2 where SOMECONDITION_2),
$c = unionall($a,$b)

这就是我得到的:

enter image description here

希望有所帮助

此致