I really need your help with a cypher code. I am working on a project and I a have the schema below.
I want for every element in the "Network_Name" column and for each Datetime (distinct selection according to the Network_Name and Datetime) to count the number of user and return those three columns ("Network_Name", "Datetime" and user count).
match(n:Network)<-[:BELONGS_TO]-(u:User)
return n.network_name as network_name, n.datetime as datetime, count(u) as user_count
The key point is in the 'with' statement, where the statement groups the rows by 'network_name' and 'datatime' of the network node, then counts the number of users for each distinct group. This is how the aggregation functions works, i.e., the rows are grouped by the distinct values of the variables provided on the 'with' or 'return' statement, whenever an aggregate functions exists.