Hi
I have the following query:
OPTIONAL MATCH (s:GraphTarget {AppId:$AppId})-[e0:OwnerOf]->(a:Source)-[e1 {Verified:true}]-(i:Source)
WITH s AS s, e0 AS e0, a AS a, e1 AS e1, i AS i limit 100
OPTIONAL MATCH(s)-[my0:MyInstitutes]-(ins0:Institutes)-[be0:BeenAt]-(in0:Institute)
RETURN *
This query return 10MB of results to the client (most of them are duplicated).
When removing any one of the OPTIONAL MATCH
from the query, the result returned is relatively small (100+ nodes).
The second OPTIONAL MATCH
is there just in case the first one did not return any result, so only then I need to run the second one. The second one is really really small, 3 nodes.
Is it possible to run the second OPTIONAL MATCH
only if the first one did not return any results?
if not, what are my options here to run it all in a single query?
Thanks