cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

neo4j sum

I'm starting with neo4j 

have the following nodes and relationships

(i1:Item{name:'Computer', price:1500.00, id:1}),
(i2:Item{name:'Video_Game', price:3500.00, id:2}),
(i3:Item{name:'Book1', price:50.00, id:3}),
(i4:Item{name:'Book2', price:20.00, id:4}),

(s1:Store{name:'Store', location:'Street R', id:5}),
(s2:Store{name:'BookStore', location:'Street Z', id:6});

graph (2).png



 

 

 

 

 

 

 

My question is, how can i get the sum of products's price per each store

Something like this...

Store | BookStore

 5.000| 70.00

1 ACCEPTED SOLUTION

Hello @1121vv 🙂

MATCH (store)-[:Sells]->(item) 
RETURN store.name AS store, sum(item.price) AS total;

Regards,
Cobra

View solution in original post

2 REPLIES 2

Hello @1121vv 🙂

MATCH (store)-[:Sells]->(item) 
RETURN store.name AS store, sum(item.price) AS total;

Regards,
Cobra

It worked perfectly! Thanks a lot for the help!