Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-04-2020 02:19 PM
I have two labels Searchable and Unsearchable on one of my node...
Right now I have only Searchable nodes... So wanted to get counts of Unsearchable and assume that I will get 0. So my query was
optional match (c:Country)
return
count(c) as countries,
count(c:Unsearchable) as unsearchableCountries
i assumed result should be
countries: 10 (as I have 10 countries marked as Searchable)
unsearchableCountries: 0 (as right now i have no Unsearchable country)
but I get 10 for both the values.
Can someone please help... what I am doing wrong?
Solved! Go to Solution.
03-04-2020 02:26 PM
I solved it using sum and case
optional match (c:Country)
return
count(c) as countries,
sum(CASE WHEN c:Unsearchable THEN 1 ELSE 0 END) as unsearchableCountries
03-04-2020 02:26 PM
I solved it using sum and case
optional match (c:Country)
return
count(c) as countries,
sum(CASE WHEN c:Unsearchable THEN 1 ELSE 0 END) as unsearchableCountries
All the sessions of the conference are now available online