Search code examples
neo4jneo4jclient

Does Neo4j have "In" expression?


i am learning Cypher using .NETClient, I've worked with TSQL before there was an expression called In :

SQL IN is an operator used to pull data matching a list of values. A scenario where this proves useful would be if we wanted to retrieve customer data for two or more customers. We can use the IN operator to specify a list of customer names, and SQL will retrieve rows reflecting every customer in the list.

I was Wondering is there anything equal to this expression in Cypher?


Solution

  • Yes, IN exists:

    MATCH (a)
    WHERE a.name IN ['Peter', 'Tobias']
    RETURN a
    

    See the docs for more details: http://neo4j.com/docs/developer-manual/3.1/cypher/clauses/where/#_lists