Neo4j, get all relationships between a set of nodes

后端 未结 6 1093
遥遥无期
遥遥无期 2021-01-05 00:13

I\'ve a query that fetches nodes based on a property

MATCH (c { type: \'sometype\' })
WITH c LIMIT 100
RETURN c

all I want is to also fetch

6条回答
  •  孤街浪徒
    2021-01-05 00:59

    This is straight forward.

    MATCH (a)-[r]-(b)
    WHERE a.type = 'foo' AND b.type = 'foo'
    RETURN DISTINCT r
    

    You could equally use the new syntax:

    MATCH (a { type : 'foo' }) -[r] - (b {type : 'foo'})
    RETURN DISTINCT r
    

    If you prefer it.

提交回复
热议问题