With

本页介绍如何使用 WITH 子句,借助 Cypher®.With 类。

一个 With 子句接受多个参数。直接传入变量,无需别名。

const movie = new Cypher.Node();
const withClause = new Cypher.With(movie);
WITH this0

别名

可以将任意表达式传递给 With,并将其别名为 Variable,以便在查询后续使用,只需传入表达式和别名变量的元组。

const variable = new Cypher.Variable();
new Cypher.With([new Cypher.Literal("Hello"), variable]);
WITH "Hello" AS var0

如果已知别名,可直接使用字符串作为别名值。

new Cypher.With([new Cypher.Literal("Hello"), "myVar"]);
WITH "Hello" AS myVar

通配符

With 接受字符串 "*",用于添加通配符以携带所有现有变量。此参数不能被别名化,并且总是位于 WITH 语句的开头。

new Cypher.With("*", [movieNode, "result"]);
WITH *, this0 AS result
© . This site is unofficial and not affiliated with Neo4j, Inc.