Hi, I have to count number of MET_EVENT between personId= 1222333442 and 1222333441 , between personId =1222333441 and personId = 1222333445.
I am running this query -
match (p:Person) where p.nationalId = "1222333442"
match (p:Person)-[r1:MET_EVENT]->(other:Person)-[r2:MET_EVENT]->(a:Person)
where NOT (p)-[:MET_EVENT]->(a) and not p.nationalId=a.nationalId
return
distinct(a.nationalId) as secondLevelContact,
count(r2) as secondLevelContactCount,
other.nationalId as firstLevelContact,
count(r1) as firstLevelContactCount,
p.nationalId as nationalId
But i am getting this result -
Exclude row 1 and row3
For row number 2, firstLevelContactCount is 3 which is correct but secondLevelContactCount should be 1 instead of 3.
What could be the issue?