NEO4J aggregation and sum

If my question is simple, I’m sorry, I’m the NOOB of neo4j.

I’m trying to write a password query, which will start from [ Find the desc order of all purple nodes in the value of sum(mass_of * contains), all paths change from purple to red]

Example:
In the picture, for all red paths, it will be [ (mass_of * contains)], and then sum all the red paths.

I started with this query, but I don’t know where to start.

 MATCH p0=(p:Purple)-[m:mass_of]->(g:Green)-[c:contains]->(r:red {name: "something"})
WITH m, c. amount * m.amount as total_per_path
WITH total_per_path, reduce( total=0, node IN collect(m)| total + total_per_path) AS total_something
RETURN total_something as TOTAL, total_per_path as PER_TOTAL_PATH

< p>…

Thank you for your help.

This should do it A little

MATCH (p:Purple)-[m:mass_of]->(g:Green)-[c:contains]->(r:red { name: "something"})
RETURN p, SUM(c.amount * m.amount) AS total
ORDER BY total DESC

If you need nodes/relationships, you can also Collect m, g or c in return.

If my question is simple, I am sorry, I am NOOB of neo4j.

Example:
In the picture, for all red paths, it will be [(mass_of * contains)], and then find all red paths And.

I started with this query, but I don’t know where to start.

MATCH p0=(p:Purple)-[m:mass_of ]->(g:Green)-[c:contains]->(r:red {name: "something"})
WITH m, c.amount * m.amount as total_per_path
WITH total_per_path , reduce( total=0, node IN collect(m)| total + total_per_path) AS total_something
RETURN total_something as TOTAL, total_per_path as PER_TOTAL_PATH

Thank you Help.

This should do it

MATCH (p:Purple)- [m:mass_of]->(g:Green)-[c:contains]->(r:red {name: "something"})
RETURN p, SUM(c.amount * m.amount) AS total
ORDER BY total DESC

If you need nodes/relationships, you can also collect m, g or c in return.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2300 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.