0
votes

Does anyone know how I can write a cypher query like "return the node, except the person at question also follows Mr.X or Ms.Y" I've been trying for ages... Don't seem to manage. :(

I don't mean "return all except Mr. X and Ms. Y", but return if the above query fits.

Something like the following does not work if A also follows other people.

START a=node(1) MATCH (a)-[:follows]->(b) WHERE b.name!="Mr.X" and b.name!="Ms.Y" RETURN a

1
Do you mean that you want to return all people who do not follow Mr. X and Ms. Y? - Luanne
Yes. Although there is the difficulty that it could be that these people (Mr. X and Ms. Y) do not exist. - lisaBZT

1 Answers

0
votes

Maybe you should try <> for comparison instead,

START a=node(1) MATCH (a)-[:follows]->(b) WHERE b.name<>"Mr.X" and b.name<>"Ms.Y" RETURN a