计算每个级别-neo4j的收入

时间:2017-03-16 07:07:16

标签: neo4j graph-databases relation

我有以下查询来查找佣金,如level1-20%,level2-10%,level 3 - 5%使用neo4j使用两个关系AFFILIATE_TO和PAID如下所示。

with [20.0, 10.0, 5.0] as percents
match (i:Instructor)-[r:AFFILIATE_TO*..3]->()-[:PAID]->(t:Payment)
with i, percents[size(r) - 1] as percent, t
with i, t.amount * percent / 100.0 as cut
return i.name as Name, sum(cut) as revenue

这里它返回每位教师的收入总和,是否可以计算此查询的个人收入。来自每个级别的收入?

我的意思是详细信息教师姓名,收入金额,20%收入金额,10%收入金额,5%收入金额 enter image description here

1 个答案:

答案 0 :(得分:3)

Cypher按您返回的所有密钥按-(void)refreshPermission { if(!isExecuting){ isExecuting = YES; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // Perform your tasks isExecuting = NO; } } } 汇总或分组。因此,如果您希望从每个级别获得RETURN收入,您还需要RETURN级别大小,或者至少在RETURN语句中将其用于groupby。

WITH