cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Count nodes with a relationship and specific proerties

lingvisa
Graph Fellow
match (n:Product)-[r:instanceOf]-(m:Category) where exists(n.ID`) and exists(m.ID) return distinct count(n)


This returns the number of relationships in which n and m occurs.

What I want is to find the unique number of n or m where n is instanceOf m and both n & m have the property 'ID'.

1 REPLY 1

intouch_vivek
Graph Steward

Try below

match (n:Product)-[r:instanceOf]-(m:Category) where exists(n.ID) and exists(m.ID) With count(distinct n)  as N, count(distinct m) as M return N, M