Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-30-2020 12:18 AM
I have a fictitious example of students doing test questions
student answers questions either "CORRECT" or "WRONG"
I can find the question that students answered incorrectly most often using:
MATCH (s:Student)-[r:ANSWERED {result: "WRONG"}]->(q:Question)
RETURN q.qId as Question, COUNT(r) as answeredWrong
ORDER BY answeredWrong DESC
This shows me a table such as:
Question | answeredWrong |
---|---|
"4" | 5 |
"3" | 3 |
"2" | 2 |
"1" | 1 |
"5" | 1 |
But how can I show a list of students who got that question wrong as part of the tabular results?
Solved! Go to Solution.
03-30-2020 02:40 AM
Hi Adam,
I think you could do something like the following (just guessing without knowing the attributes of the node Student):
MATCH (s:Student)-[r:ANSWERED {result: "WRONG"}]->(q:Question)
RETURN q.qId as Question, COUNT(r) as answeredWrong, COLLECT(s.name) as studentsWhoGaveWrongAnswers
ORDER BY answeredWrong DESC
Regards,
Elena
03-30-2020 02:40 AM
Hi Adam,
I think you could do something like the following (just guessing without knowing the attributes of the node Student):
MATCH (s:Student)-[r:ANSWERED {result: "WRONG"}]->(q:Question)
RETURN q.qId as Question, COUNT(r) as answeredWrong, COLLECT(s.name) as studentsWhoGaveWrongAnswers
ORDER BY answeredWrong DESC
Regards,
Elena
All the sessions of the conference are now available online