File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
modules/ROOT/pages/clauses Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,42 @@ The combined result is returned, without duplicates.
124124|Rows: 3
125125|===
126126
127+ [[union-combining-distinct-and-all]]
128+ == Combining UNION DISTINCT and UNION ALL
129+
130+ It is not allowed to mix `UNION DISTINCT` and `UNION ALL` in the same chain of clauses.
131+ This can be solved by enclosing one or more `UNION` of the same type in curly braces
132+ allowing the enclosed query to be used as an argument to the outer `UNION`.
133+
134+ .Query
135+ [source, cypher]
136+ ----
137+ {
138+ MATCH (n:Actor)
139+ RETURN n.name AS name
140+ UNION
141+ MATCH (n:Director)
142+ RETURN n.name AS name
143+ }
144+ UNION ALL
145+ MATCH (n:Movie)
146+ RETURN n.title AS name
147+ ----
148+
149+ The combined result is returned.
150+
151+ .Result
152+ [role="queryresult",options="header,footer",cols="1*<m"]
153+ |===
154+ | name
155+ | "Johnny Depp"
156+ | "Sarah Jessica Parker"
157+ | "Ed Wood"
158+ | "Ed Wood"
159+ |Rows: 4
160+ |===
161+
162+
127163
128164[[post-union-processing]]
129165== Post-union processing
You can’t perform that action at this time.
0 commit comments