Skip to content

Commit a3ee243

Browse files
committed
made it clearer that the {} braces are necessary, replaced an example with a different one that uses the example data set
1 parent 8289a5b commit a3ee243

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

modules/ROOT/pages/queries/composed-queries/sequential-queries.adoc

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Finally, the fourth query is another conditional query which subsumes multiple b
251251

252252
=== Using `NEXT` inside a conditional query using `{}`
253253

254-
In a conditional query that that has a `NEXT` in any of its `THEN` blocks or the `ELSE` block, wrap the part after `THEN` or `ELSE` with `{}`.
254+
In a conditional query that that has a `NEXT` in any of its `THEN` blocks or the `ELSE` block, it is necessary to wrap the part after `THEN` or `ELSE` with `{}`.
255255

256256
.`NEXT` inside a conditional query
257257
[source, cypher]
@@ -332,35 +332,43 @@ By using xref:functions/aggregating.adoc#functions-count[`count()`], the list ag
332332

333333
=== Using `NEXT` inside a `UNION` using `{}`
334334

335-
In a `UNION` query that that has a `NEXT` in any of its blocks, wrap that block with `{}`.
335+
In a `UNION` query that that has a `NEXT` in any of its blocks, it is necessary to wrap that block with `{}`.
336336

337337
.`NEXT` inside `UNION`
338338
[source, cypher]
339339
----
340340
{
341-
RETURN 1 AS a
341+
MATCH (c:Customer)-[:BUYS]->(:Product {name: 'Chocolate'})
342+
RETURN c AS customer
342343
343-
NEXT
344+
NEXT
344345
345-
RETURN a + 1 AS b
346+
RETURN customer.firstName AS plantCustomer
346347
}
348+
347349
UNION ALL
350+
348351
{
349-
RETURN 1 AS a
352+
MATCH (c:Customer)-[:BUYS]->(:Product {name: 'Coffee'})
353+
RETURN c AS customer
350354
351-
NEXT
355+
NEXT
352356
353-
RETURN a + 1 AS b
357+
RETURN customer.firstName AS plantCustomer
354358
}
355359
----
356360

357361
.Result
358362
[role="queryresult",options="header,footer",cols="1*<m"]
359363
|===
360-
| b
364+
| plantCustomer
361365

362-
| 2
363-
| 2
366+
| "Amir"
367+
| "Mateo"
368+
| "Yusuf"
369+
| "Mateo"
370+
| "Hannah"
371+
| "Niko"
364372

365-
1+d|Rows: 2
373+
1+d|Rows: 6
366374
|===

0 commit comments

Comments
 (0)