V4.1
Format, Parameters
UNION ALL splices two data columns head-to-tail and generate one column, but NOT deduplicate this new column before passing to the next statement. The final column has a length equal to the sum of lengths of the input columns.
Syntax:
- Format:
... return<columnA1>
as<alias1>
,<columnA2>
as<alias2>
, ...
union all
... return<columnB1>
as<alias1>
,<columnB2>
as<alias2>
, ... - Parameters: see table below
- Affected columns:
<columnA>
,<columnB>
Name | Category | Specification | Description |
---|---|---|---|
<columnA> |
NODE,EDGE,PATH,ATTR,ARRAY,TABLE | / | The first UQL statement's returned result |
<columnB> |
NODE,EDGE,PATH,ATTR,ARRAY,TABLE | / | The first UQL statement's returned result, which requires to have the same number of returned result, alias, and category with the same alias |
<alias> |
string | With the same naming convention as custome alias | The alias of returned valus, the aliases from two UQL statements' returned results must be the same, order of which does not need to be mapped |
Analysis
find().nodes([3,4,5]) as n1
return n1 as a1, n1.color as a2
union all
find().nodes([4,7]) as n1
return n1 as a1, n1.color as a2
Each of the two UQL statements above has one returned column for NODE and ATTR repectively, connected and deduplicated by UNION ALL.
Common Usage
Example: find cards that transfered to Card CA029 with an amount higher than 1000, and cards that transfered to Card CA022 with an amount higher than 3000, return results after deduplication
n({_id == "CA029"}).le({@transfer.amount > 1000}).n({@card} as n) return n
union all
n({_id == "CA022"}).le({@transfer.amount > 3000}).n({@card} as n) return n