vishal patel
vishal patel

Reputation: 832

Neo4j: how to compare two nodes

I have a following query. The goal of the query is to get all the nodes except certain nodes

MATCH (u:User) 
WHERE NOT exists(u.canceled)
WITH u
MATCH (u1:User)
WHERE NOT exist(u.password) AND NOT u
RETURN u1

I got Type mismatch: expected Boolean but was Node Error.

How can i get all 'u1' nodes without 'u' nodes?

Upvotes: 3

Views: 2710

Answers (1)

Christophe Willemsen
Christophe Willemsen

Reputation: 20185

The exception is for this line :

WHERE NOT exist(u.password) AND NOT u

especially the AND NOT u

If you want to say that u1 should not be the same node as u, then you should write the following :

WHERE NOT EXISTS(u.password)
AND u1 <> u

Upvotes: 3

Related Questions