【问题标题】:Cypher: Passing multiple parameters in WHERE INCypher:在 WHERE IN 中传递多个参数
【发布时间】:2014-11-05 10:49:56
【问题描述】:

WHERE条件如何传递参数?

确实如此,这很好用:

match (b:Book) where b.guid={guid} return b;

但是,如何将多个 guid 作为此查询的参数传递:

match (b:Book) where b.guid in [guid1,guid2,gid3] return b;

我使用的是neo4jphp客户端,我的代码是这样的:

$client = new Everyman\Neo4j\Client( "neo4j server address", "7474" );
$result = new Everyman\Neo4j\Cypher\Query( $client, "match (b:Book) where b.guid={guid} return b", array('guid'=>$guid1) );
$res = $result->getResultSet();

【问题讨论】:

    标签: neo4j cypher neo4jphp


    【解决方案1】:

    你应该传递一个数组作为参数,查询应该是这样的:

    match (b:Book) where b.guid in {myMap} return b;
    
    
    $client = new Everyman\Neo4j\Client( "neo4j server address", "7474" );
    $result = new Everyman\Neo4j\Cypher\Query( $client, "match (b:Book) where b.guid in {MyMap} return b", array('myMap'=> array($guid1, $guid2, $guid3)) );
    $res = $result->getResultSet();
    

    【讨论】:

    • 谢谢。这似乎对我不起作用。我会再次检查。我正在使用 neo4j-community-2.1.5
    • 你能在你的查询中试试这个吗?在 [{myMap}]
    • 谢谢,我试试这个。
    猜你喜欢
    • 1970-01-01
    • 2013-12-12
    • 1970-01-01
    • 1970-01-01
    • 2015-05-10
    • 2012-05-20
    • 2012-07-30
    • 2021-08-10
    • 1970-01-01
    相关资源
    最近更新 更多