-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
USE GRAPH financialGraph | ||
|
||
CREATE OR REPLACE QUERY q2b () SYNTAX v3 { | ||
|
||
//think the FROM clause is a matched table with columns (a, e, b) | ||
//you can use SQL syntax to group by the source and target account, and sum the total transfer amount | ||
SELECT a, b, sum(e.amount) INTO T | ||
FROM (a:Account)-[e:transfer]->(b:Account) | ||
GROUP BY a, b; | ||
|
||
//output the table in JSON format | ||
PRINT T; | ||
|
||
} | ||
|
||
#compile and install the query as a stored procedure | ||
install query q2b | ||
|
||
#run the query | ||
run query q2b() |