Michael, thanks for the reply. I got it. Just quick question: is it possible to use "ORDER BY" at the end of the union?
On Monday, June 23, 2014 5:53:54 PM UTC-4, Michael Hunger wrote: > > There is no such thing as "throw the result "Users" into" > > there is no result of union that you can access from cypher. > > It just returns the union of your 3 queries to the client. Currently you > can't do anything with the combined data within Cypher. > > Michael > > Am 23.06.2014 um 23:17 schrieb Alx <[email protected] <javascript:>>: > > Hi Michael, > > I am confused with your answer. I am trying to union the first 3 MATCH > queries and throw the result "Users" into > > MATCH p = allShortestPaths((n)-[*]-(Users)) RETURN COUNT(*) > > to find the shortest paths. > > > On Saturday, June 21, 2014 6:22:37 PM UTC-4, Michael Hunger wrote: >> >> The final query is: >> >> MATCH (n:User{id:'2'}) - [:WENT_TO] -> (bar) <-[: WENT_TO] -(m3) WHERE >> n.age=m3.age RETURN m3 AS Users >> MATCH p = allShortestPaths((n)-[*]-(Users)) RETURN COUNT(*) >> >> >> not >> >> MATCH (n:User{id:'2'}) - [:WENT_TO] -> (bar) <-[: WENT_TO] -(m3) WHERE >> n.age=m3.age RETURN m3 AS Users >> >> >> Michael >> >> Am 21.06.2014 um 22:13 schrieb Alx <[email protected]>: >> >> Sure! Here are the 3 union queries with the red one being the final >> query. I know I can put the final query inside each individual query but I >> guess this is not very efficient. Thanks for the help. >> >> MATCH (n:User{id:'2'}) - [:LOCATED_IN|:HAS_FAX_NUMBER|:HAS_PHONE_NUMBER] >> -> () <-[:LOCATED_IN|:HAS_FAX_NUMBER|:HAS_PHONE_NUMBER]-(m1) WHERE >> m1.type='Professional' RETURN m1 AS Users >> UNION >> MATCH (n:User{id:'2'}) - [:TEXTED] ->() < - [: TEXTED] -(m2) MATCH p = >> allShortestPaths((n)-[*]-(m2)) RETURN m2 AS Users >> UNION >> MATCH (n:User{id:'2'}) - [:WENT_TO] -> (bar) <-[: WENT_TO] -(m3) WHERE >> n.age=m3.age RETURN m3 AS Users >> MATCH p = allShortestPaths((n)-[*]-(Users)) RETURN COUNT(*) >> >> >> On Saturday, June 21, 2014 11:05:31 AM UTC-4, Michael Hunger wrote: >>> >>> Perhaps you can share your query with us, perhaps it is easier to >>> rewrite it to something else? >>> >>> In general right now it is not possible to do anything else with the >>> results of a union query. >>> Michael >>> >>> Am 19.06.2014 um 21:58 schrieb Alx <[email protected]>: >>> >>> I want to use UNION to remove the duplicates from 3 MATCH queries and >>> apply a query on the results. Is it possible? If not what 's the workaround? >>> >>> -- >>> 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 [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >>> >>> >> -- >> 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 [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> >> >> > -- > 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 [email protected] <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
