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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to