I'm trying to count an attribute based on its value.
I have a node "athlete" that has a relationship "attends" to a node "competition", on the relationship "attends" is an attribute "FinishPosition" which is a number.
<(ath:Athlete)-[att:ATTENDS]->(cmp:Competition)/>
How do i count for each athlete how many times they finished first, second and third to create a medal table
Athlete First Second third
fred 3 1 0
Joe 2 4 2
etc.
Ive been trying count(att.FinishPosition=1) etc. and CASE statements but can't get the right result.
I'm sure the answer is simple and I'm missing a trick.
Thanks
Paul