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.

Query to get nodes who don't have any relationships ?

Mayur
Node Link

Hi Team,

I am learner and i am trying for query which will get only those nodes who don't have any relationship at all ,
Can anyone please help me in that.

Thanks
Mayur

2 ACCEPTED SOLUTIONS

Try this:

Match(n)

where not exists ( (n)—() )

return n 

View solution in original post

Thanks @glilienfield   after putting that query in Neo4j it was throwing syntax error after looking closely observed that big hypen is nothing but two hypens (--)
Match
(n:Lineage)
where not exists ( (n)--() ) 
return n

View solution in original post

4 REPLIES 4

Try this:

Match(n)

where not exists ( (n)—() )

return n 

Thanks @glilienfield   after putting that query in Neo4j it was throwing syntax error after looking closely observed that big hypen is nothing but two hypens (--)
Match
(n:Lineage)
where not exists ( (n)--() ) 
return n

Sorry, I did it on my iPhone, which must have converted it to a long dash. Glad you figured it out.