Caio
Caio

Reputation: 15

OrientDB - Result from 2 different tables

I have a database that has 2 V's classes ('User' that has 2 strings named Name and Surname ,'Cinema') and 2 E's classes ('isGoing' that has an Integer property named Day, 'Friend'). This select returns all the 'Cinema' that the 'Friend' of the initial Vertex are going on a specific day.

SELECT expand(both('Friend').outE('isGoing')[Day = 29].inV()) FROM #12:0

But now I need to get all the 'User' Name and Surname that are 'Friend' of the initial vertex, the 'isGoing' property Day and have the 'isGoing' Edge going from the 'User' to a specific 'Cinema' (let's say it is #14:0). The expected result would be a list of: String 'Name', String 'Surname' and int 'Day'. Something like:

SELECT Name, Surname, Day FROM (SELECT expand(both('Friend').outE('isGoing').inV()) FROM #12:0) WHERE @rid = #14:0

Is this possible in OrientDB?

Upvotes: 0

Views: 585

Answers (1)

wolf4ood
wolf4ood

Reputation: 1949

try this

SELECT in.*,out.*,Day 
FROM (SELECT expand(both('Friend').outE('isGoing')[Day = 29]) 
      FROM #12:0)

Upvotes: 1

Related Questions