I have a query like this: MATCH (a)-[:Shout]->(b) WHERE a.user_id=1 WITH b.post_id as b_post_id, a, b.post as b_post MATCH (a)-[:Friend]->(c)-[:Shout]->(d) WITH d.post_id as d_post_id, b_post_id, d.post as d_post, b_post order by d_post_id desc, b_post_id desc RETURN collect(distinct d_post) + collect(distinct b_post) as p
I want to return all posts that are from user and friend so I combine the 2 match the first match (a)-[:Shout]->(b) will return posts from user and the second match (a)-[:Friend]->(c)-[:Shout]->(d) will return posts from friend. The posts of (a)-[:Shout]->(b) are post_id: 5, post: nana post_id: 2, post: hi The posts of (a)-[:Friend]->(c)-[:Shout]->(d) arepost_id: 6, post: lalapost_id: 4, post: hellopost_id: 3, post: hanson So, when I RETURN collect(distinct d_post) + collect(distinct b_post) as p, it will beP: nana, hi, lala, hello, hanson It should be: lala, nana, hello, hanson, hi or 6,5,4,3,2 Please help me. Thanks. -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.