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.

I am using two conditions but once I am having the result displayed , there is only one condition executed

I am using this query and I used conditions to display only clusters which contains more than 3 contracts and 2 attributes but I am having a graph which contains clusters with only one contract .

match (n1:attribfxplaf)-[r]-(c:contratfxplaf)
with n1.clusterId as clusterId, count(n1) as attributaires, count(c) as contracts
where contracts > 3 and  attributaires > 2
match (n2) where n2.clusterId = clusterId
return n2,clusterId

3 REPLIES 3

It's likely that the counts of contracts are counting the same node multiple times (the c is the same for nodes in that match with the same clusterId).

Try changing your query to count distinct nodes:

with n1.clusterId as clusterId, count(n1) as attributaires, count(DISTINCT c) as contracts

I am getting the same results !

use this query to help debug the problem ...

match (n1:attribfxplaf)-[r]-(c:contratfxplaf)
return n1.clusterId as clusterId, count(n1) as attributaires, count(distcint c) as contracts
order by clusterId