youssef mahersi
youssef mahersi

Reputation: 15

A cypher query to get two nodes with 0 records in some but with records in other one

i have a node Activist has a property email also a node Customer has a property email i want to find an email exists in the nodes at the same time i tried this query

match(a:Activist{email:"[email protected]"}),
(c:Customer{email:"[email protected]"})
return a,c

in the db, I have a customer with this email and no activist with email , but when i get the result i see no records but i want to get the node that has this email

(no changes, no records)

Upvotes: 0

Views: 30

Answers (1)

Charchit Kapoor
Charchit Kapoor

Reputation: 9284

You are generating Cartesian Product, that's why it's giving 0 records. Simply, use optional match, for both the nodes, like this:

optional match(a:Activist{email:"[email protected]"})
optional match(c:Customer{email:"[email protected]"})
return a,c

Upvotes: 1

Related Questions