cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax: Retrieving nodes filtered by a property value

Codes below produce error as output. "Neo.ClientError.Statement.SyntaxError"Any help?

Syntax: Retrieving nodes filtered by a property value

You have learned previously that you can filter node retrieval by specifying a label. Another way you can filter a retrieval is to specify a value for a property. Any node that matches the value will be retrieved.

Here are simplified syntax examples for a query where we specify one or more values for properties that will be used to filter the query results and return a subset of the graph:

Syntax

MATCH (variable {propertyKey: propertyValue})
RETURN variable

Syntax

MATCH (variable:Label {propertyKey: propertyValue})
RETURN variable

Syntax

MATCH (variable {propertyKey1: propertyValue1, propertyKey2: propertyValue2})
RETURN variable

Syntax

MATCH (variable:Label {propertyKey: propertyValue, propertyKey2: propertyValue2})
RETURN variable
1 REPLY 1

ameyasoft
Graph Maven
MATCH (variable {propertyKey: propertyValue})
MATCH (variable {propertyKey1: propertyValue1, propertyKey2: propertyValue2})

Both queries gives all the nodes that contain the selected property/values. To get the results as count of each node label, use this:

RETURN distinct labels(variables) as lbl, count(distinct variable) as cnt

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.