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.

Female or Male number filtering

I am trying to filter females' and male relationships and get a table for both relations and find how many males and females are there? But My code is not helping me out to solve it> Any suggestions, I try with UNION ALL as well, didn't work for me \

> MATCH (std:student{gender: 'M'})-[:major]->(dgr:degree) <-[:administer]-(dep:department)
> where dep:department='Computer Science'
> MATCH (std:student{gender: 'F'})-[:major]->(dgr:degree) <-[:administer]-(dep:department)
> where dep:department='Computer Science'
> RETURN count(std.gender) as males,count(std.gender) as females

Blockquote

2 REPLIES 2

ameyasoft
Graph Maven
Try this:

MATCH (std:student)-[:major]->(dgr:degree) <-[:administer]-(dep:department)
where dep:department='Computer Science'

with distinct std.gender as gender, count(distinct std) as cnt
return gender, cnt

Please put Limit 11 on number of rows returned so that server will not send all the data to client machine.

Thanking you
G Sameer