5ar
5ar

Reputation: 84

OrientDB query for nodes connected to origin by multiple ways

For example, I have employee managing particular country and particular company. I want to query only accounts which are in countries AND companies managed by the given employee. Ideas? Performance issues to be aware of?

Gremlin query is acceptable, also!

Upvotes: 0

Views: 71

Answers (1)

5ar
5ar

Reputation: 84

This seems to work:

select from Account where 
@rId in 
(select expand(out('managingCountry').in('inCountry')).@rId
from Employee where userId = 3) 
AND 
@rId in 
(select expand(out('managingCompany').in('inCompany')).@rId
from Employee where userId = 3) 

Remains if someone has the better solution

Upvotes: 1

Related Questions