Neo4j:如何显示行位置?

时间:2018-11-14 11:29:12

标签: neo4j return cypher row

我有一个标签为Person的属性:name和birthDay,如何显示带有该位置的新字段?

enter image description here

我会这样:

enter image description here

1 个答案:

答案 0 :(得分:1)

您必须创建一个临时集合:

MATCH (p:Person)
WITH collect(p) AS persons
UNWIND range(1, size(persons)) AS i
RETURN i AS pos, (persons[i-1]).name AS name, (persons[i-1]).birthDay AS birthday

╒═════╤══════╤════════════╕
│"pos"│"name"│"birthday"  │
╞═════╪══════╪════════════╡
│1    │"Raf" │"05/07/1992"│
├─────┼──────┼────────────┤
│2    │"Mary"│"10/08/1991"│
├─────┼──────┼────────────┤
│3    │"Luke"│"11/01/1995"│
└─────┴──────┴────────────┘