You can chain the query arts together the usage of the WITH clause.
Syntax
Following is the syntax of the WITH clause.
MATCH (n)
WITH n
ORDER BY n.property
RETURN collect(n.property)
Example
Following is a pattern Cypher Query which demonstrates the use of the WITH clause.
MATCH (n)
WITH n
ORDER BY n.name DESC LIMIT 3
RETURN collect(n.name)
To execute the above query, perform the subsequent steps −
Step 1 − Open the Neo4j laptop App and start the Neo4j Server. Open the integrated browser app of Neo4j the use of the URL http://localhost:7474/ as proven inside the following screenshot.
Step 2 − Copy and paste the preferred query in the dollar prompt and press the play button (to execute the question) highlighted inside the following screenshot.
Result
On executing, you will get the following end result.