Skip to content

Commit

Permalink
example of scope and order of variable and set operator (vesoft-inc#2280
Browse files Browse the repository at this point in the history
)
  • Loading branch information
abby-cyber authored Oct 8, 2023
1 parent 3795137 commit 261f636
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,18 @@ nebula> $var = GO FROM "player100" OVER follow YIELD dst(edge) AS id; \
| "Spurs" | "Manu Ginobili" |
+-----------+-----------------+
```

## Set operations and scope of user-defined variables

When assigning variables within a compound statement involving set operations, it is important to enclose the scope of the variable assignment in parentheses. In the example below, the source of the `$var` assignment is the results of the output of two `INTERSECT` statements.

```ngql
$var = ( \
GO FROM "player100" OVER follow \
YIELD dst(edge) AS id \
INTERSECT \
GO FROM "player100" OVER follow \
YIELD dst(edge) AS id \
); \
GO FROM $var.id OVER follow YIELD follow.degree AS degree
```

0 comments on commit 261f636

Please sign in to comment.