MATCH(wu:wiki_user) 可选匹配(n:wiki_doc {author:wu.uid}),(o:wiki_doc {editor:wu.uid}) 返回wu.uid AS用户名,wu.org AS组织,wu.email AS电子邮件,wu.token AS余额, count(n)AS编写,count(o)AS修改;
user_id | organization | email | balance | writing | modifying
--------------------------------------------------------------------------
"ailee" | "Org2" | "hazel@gbc.com" | 5 | 0 | 0
"hazel" | "Org1" | "hazel@gbc.com" | 5 | 2 | 2
match (n:wiki_doc{editor:'hazel'}) return n;
wiki_doc[9.11]
{"bid": "hazel_doc1", "cid": "Basic", "org": "Org1", "title": "Hello world!",
"author": "hazel", "editor": "hazel", "revnum": 1, "created": "2018-09-25
09:00:000", "hasfile": 2, "contents": "I was wrong", "modified": "2018-09-25
10:00:000"}
(1行)
实际上,在榛树的情况下,更新次数为1和2 使用上述查询时,将使用查询。
如何修改查询,以便通常只能查看一个查询。
答案 0 :(得分:1)
MATCH(
wu:wiki_user
)
可选匹配(n:wiki_doc{author:wu.uid})
,(o:wiki_doc{editor:wu.uid})
返回wu.uid AS用户名,wu.org AS组织,wu.email AS电子邮件,wu.token AS余额,
count(distinct id(n)) as Writing, count(distinct id(o))
为修改中
user_id | organization | email | balance | writing | modifying
+----------------------------------------------------------+
"ailee" | "Org2" | "hazel@gbc.com" | 5 | 0 | 0
"hazel" | "Org1" | "hazel@gbc.com" | 5 | 2 | 1
(2行)