Search code examples
orientdborientdb2.2

OrientDB: select edge where out=(select ??) does not work


I have a problem. I think that this is supposed to work, otherwise someone else would have run into this problem.

The following command works perfectly:

// suppose my record id is #10:0

select from MyEdgeType where out=#10:0

This works.

select from MyNodeType where name="this"
> returns obj with @rid = #10:0

The following does not work:

select from MyEdgeType where out=(select from MyNodeType where name="this")
select from MyEdgeType where out=(select @rid from (select from MyNodeType where name="this")
select from MyEdgeType let $rec = (select fcom MyNodeType...) where out=$rec.rid


... etc. 

Nothing works. Nothing. How do I select from edges such that I do not have to know the record id which is incident to the edges I would like to grab ahead of time?


Solution

  • You're comparing a single field on a resultset (it's like comparing a string to an array), try something like this:

    select from MyEdgeType where out IN (select from MyNodeType where name="this")