diff --git a/demos/guru_scripts/docker/tutorial/4.x/script/q2b.gsql b/demos/guru_scripts/docker/tutorial/4.x/script/q2b.gsql new file mode 100644 index 00000000..a70bdefa --- /dev/null +++ b/demos/guru_scripts/docker/tutorial/4.x/script/q2b.gsql @@ -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()