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