Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要四个不同的计数:结果总数,然后是三个类别的结果数。例如,如果我有四个学生,我希望他们按年级排序,我想要:(1)学生总数,(2)1年级学生总数,(3)年级学生总数2,(4)3年级学生总数。如果我有s.grade=1,s.grade=1,s.grade=2,s.grade=3的学生节点,有没有办法得到一个只返回我想要的结果而没有正确返回其他信息的结果?
这不包括学生总数,但您可以通过以下方式汇总每个年级的学生人数:
START n=node(*) WHERE HAS(n.grade) AND n.grade > 0 AND n.grade <= 3 RETURN DISTINCT n.grade AS grade, count(n.grade) AS count
根据您的架构/结构,您可能需要过滤n为只有学生。
n