Hi Kapli

you can expand edges and then project on in/out

select out.name, in.name from ( select expand(inE('worksAt')) from
Department where ID_dept= 'dep1')

Enrico

2015-06-05 9:25 GMT+02:00 Kapil Ranade <[email protected]>:

> Hi Giulia,
>
> Thanks for replying.
>
> The query you suggested returns details of employees (employee class)
> working at dep1, but do not return data of department (dept class).
>
> That is my problem.
>
> Let me explain it again:
>
> Two classes:
>
> Employee
> ID, NAME, DEPT_ID
> 1, Kapil, D1
> 2, Giulia, D2
> 3, Luca, D1
> 4, Mark, D3
>
> Department
> ID, Name, City, State, Country
> D1, Department 1, C1, S1, CN1
> D2, Department 2, C1, S2, CN1
> D3, Department 3, C2, S3, CN1
>
> if I fire following SQL in rdbms
>
> select E.*, D.NAME, D.CITY, D. STATE from Employee E, Department D where
> E.DEPT_ID = D.DEPT_ID and D.DEPT_ID = 'D1';
>
> I get this following result:
>
> 1, Kapil, D1, Department 1, C1, S1
> 3, Luca, D1, Department 1, C1, S1
>
> Note that name of department, city and state come from department table
> and not from employee table.
>
> How can I achieve this using orient db?
>
> On Friday, 5 June 2015 12:45:02 UTC+5:30, Giulia Brignoli wrote:
>>
>> Hi Kapil,
>>
>> if i understand your  problem, try this query:
>>
>> select name as DipendentName from ( select expand(in('worksAt')) from
>> Department where ID_dept= 'dep1')
>>
>> Bye, Giulia
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" 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 
"OrientDB" 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