英文:
count nodes per property neo4j database
问题
我有节点,称为Book。每个节点都有属性Name(所有者的姓名)。名字不多,书很多。如何运行所有Name的聚合查询,以及每个Name的书数量?
Name Book_Count
Sam 55
John 12
数据库版本:3.5
英文:
I have nodes, called Book. Each node have property Name (owner's name). It's not a lot of names, a lot of books. How to run aggregate query of all Names, and book quantity per Name?
Name Book_Count
Sam 55
John 12
Database version: 3.5
答案1
得分: 0
[更新]
这将返回每个名称的节点数量:
MATCH (b:Book)
RETURN b.Name AS name, COUNT(*) AS book_count
英文:
[UPDATED]
This will return the number nodes for each name:
MATCH (b:Book)
RETURN b.Name AS name, COUNT(*) AS book_count
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论