Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-25-2022 07:11 PM
Hi Neo4j community,
This might be a very basic beginner question, but I cannot figure it out for the life of me after browsing trying and browsing through similar questions online.
I have got a situation like this
Now I would like to know what the minimum size / maximum size and average size of all departments is, respectively. I came across similar questions but in all cases I would 'manually' go through the different properties, however what if there were more departments, say 50 different kinds which makes it infeasable.
I basically want to do something like looping through the different departments store the occurence for each distinct department in a list and figure out the min, max and avg of that list.
I feel like this should be fairly easy but cannot figure it out.
Thank you very much for any help.
Solved! Go to Solution.
04-25-2022 07:43 PM
Try this.
match(e:Employee)
with e.department as department, count(*) as deptSize
return min(deptSize) as minDeptSize, max(deptSize) as maxDeptSize, avg(deptSize) as avgDeptSize
04-25-2022 07:43 PM
Try this.
match(e:Employee)
with e.department as department, count(*) as deptSize
return min(deptSize) as minDeptSize, max(deptSize) as maxDeptSize, avg(deptSize) as avgDeptSize
04-25-2022 08:18 PM
Hi Gary,
Thank you heaps. Seems like I had the syntax slightly wrong. Appreciate the quick answer.
Best,
Philipp
All the sessions of the conference are now available online