I'm doing a neo4j project.
I'm trying to use the avg() function in a property of a relationship
This is my query:
MATCH (E1:ENTITY)-[C:CONTRACT]->(E2:ENTITY) WITH C.price as contractPrice MATCH (E1:ENTITY)-[C:CONTRACT]->(E2:ENTITY) WITH collect([E1,E2,contractPrice]) AS costRecords, avg(C.price) AS avgContractPrice WITH [record IN costRecords WHERE record > avgContractPrice] as costRecords UNWIND costRecords as record RETURN record as E1, record as E2, record as cost
So what i'm trying to show is all the "node-relationship-node" graph, where the price(C.price) is greater than the average, but i get the same result as
MATCH n RETURN n
What do i have to change?
Thank you all and stay safe