I have graph of some nodes (Persons and the college they graduated from by [:HAS_BS_SPECIALTY_IN {Score:...}] and [:HAS_PHD_SPECIALTY_IN {Score:...}] , I want to get a person with maximum score, I use the cypher query:
MATCH (p:Person)-[r]->(s)
UNWIND r.Score AS Sc
WITH max(Sc) as x, p, r
RETURN DISTINCT p.Full_Name, x, type(r)
but it shows all the scores not the maximum one, any help?
βββββββββββββββββββββββββββ€ββββββββ€βββββββββββββββββββββββ
β"p.Full_Name" β"x" β"type(r)" β
βββββββββββββββββββββββββββͺββββββββͺβββββββββββββββββββββββ‘
βPeter Adams 80 β"HAS_MS_SPECIALTY_IN" β
βββββββββββββββββββββββββββΌββββββββΌβββββββββββββββββββββββ€
βPeter Adams 88 β"HAS_PHD_SPECIALTY_IN"β
βββββββββββββββββββββββββββΌββββββββΌβββββββββββββββββββββββ€
βJohn Mayes 95 β"HAS_MS_SPECIALTY_IN" β
βββββββββββββββββββββββββββΌββββββββΌβββββββββββββββββββββββ€
βJohn Mayes 98 β"HAS_PHD_SPECIALTY_IN"β
βββββββββββββββββββββββββββΌββββββββΌβββββββββββββββββββββββ€
I just want to have John Mayes with Score: 98