i struggle return node largest value, , process node further.
here's how return node largest value:
start n=node(startnode) match n-[:type]-m return m order m.value desc limit 1 but in subquery
start n=node(somenode) match n-[:type1]-q distinct q match q-[:type2]-m and order .. limit 1 doesn't work anymore because want 1 result each q. how done?
also, once have m largest value each q i'll need process it:
return q, m.maxvalue, x.anothervalue from
match m-[:has_one_link_to]->x so while i've been playing collections (collect(m) ), haven't figured way expand them "result rows" applying match.
untested... let me know if works you:
start n=node(somenode) match n-[:type1]-q // initial query distinct q match q-[:type2]-m q, max(m.value) max // max q match q-[:type2]-m m.value = max // find max m each q q, m match m-[:has_one_link_to]->x // find x m return q, m, x
Comments
Post a Comment