Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-05-2020 05:28 PM
Hi,
Based on my example below, i wanted to return list of user stories (US1 and US2) ordered by the number of tickets related to it that is also linked SP1. In other words, find me userstories (starting) with greatest number of tickets linked to SP1.
this is query I've got right now:
MATCH (:Sprint{id:"SP1"})<-[:SPRINT_TASK]-(:Ticket)-[:SUB_TASK]->(rec:UserStory)
WITH rec, COUNT(*) AS num ORDER BY num DESC
RETURN rec
Any help will is greatly appreciated 🙂
Solved! Go to Solution.
03-05-2020 09:16 PM
Try this
MATCH (:Sprint{id:"SP1"})<-[:SPRINT_TASK]-(:Ticket)-[r1:SUB_TASK]->(rec:UserStory)
WITH rec, COUNT(r1) AS num ORDER BY num DESC
RETURN rec,num
03-05-2020 09:13 PM
MATCH (:Sprint{id:"SP1"})<-[:SPRINT_TASK]-(:Ticket)-[:SUB_TASK]->(rec:UserStory)
WITH rec, COUNT(*) AS num ORDER BY num DESC
RETURN rec, num
This will return two nodes US1
and US2
. If you click "Table" button on the left side of the output, you will get what you want.
If you don't like this, try below
If you have declared your node as (:UserStory{ name : "US1" })
,try
MATCH (:Sprint{id:"SP1"})<-[:SPRINT_TASK]-(:Ticket)-[:SUB_TASK]->(rec:UserStory)
WITH rec, COUNT(*) AS num ORDER BY num DESC
RETURN rec.name,num
Hope this helps you.
03-05-2020 09:16 PM
Try this
MATCH (:Sprint{id:"SP1"})<-[:SPRINT_TASK]-(:Ticket)-[r1:SUB_TASK]->(rec:UserStory)
WITH rec, COUNT(r1) AS num ORDER BY num DESC
RETURN rec,num
All the sessions of the conference are now available online