neo4j cypher: stacking results with UNION and WITH -
i'm doing query like
match (a) id(a) = {id} match (a)-->(x:x)-->(b:b) a, x, b match (a)-->(y:y)-->(b:b) a, x, y, b match (b)-->(c:c) return collect(a), collect(x), collect(y), collect(b), collect(c)
what want here have b
match (a)-->(y:y)-->(b:b)
composed of ones line , ones previous match (a)-->(x:x)-->(b:b)
. problem i'm having union
picky number , kind of nodes passed on next query, , i'm having trouble understanding how make go together.
what other solution use merge these nodes during query or before returning them? (or if should union
how way...)
(of course query there done in other better ways. real 1 can't. meant give visual example of i'm looking do.)
much obliged!
this simplified query might suit needs.
i took out collect() function calls, not clear need aggregate anything. example, there single 'a' node, aggregating 'a's not make sense.
please aware every row of result node labelled either 'x' or 'y'. but, since every row has have both x , y values -- every row have null value 1 of them.
start a=node({id}) match (a)-->(x:x)-->(b:b)-->(c:c) return a, x, null y, b, c union match (a)-->(y:y)-->(b:b)-->(c:c) return a, null x, y, b, c
Comments
Post a Comment