Skip to content

Commit

Permalink
Create q2b.gsql
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxiw authored Sep 12, 2024
1 parent ef367bb commit f01d505
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions demos/guru_scripts/docker/tutorial/4.x/script/q2b.gsql
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()

0 comments on commit f01d505

Please sign in to comment.