Well, this is clear, however when i run the query, i get the number of
items in the collection e.g. [2],[3] and not the names of the cars.
Sample JSON output:
{"result":[{"@type":"d","@rid":"#-2:1","@version":0,"name":"Luca","cars":[2]},{"@type":"d","@rid":"#-2:2","@version":0,"name":"Bill","cars":[0]},{"@type":"d","@rid":"#-2:3","@version":0,"name":"Jay","cars":[1]}]}
On Monday, March 17, 2014 6:51:59 PM UTC+5:30, Riccardo Tasso wrote:
>
> Figure out what you are looking for: persons? Then you'll need:
> SELECT FROM Person
>
> Now, what are you looking for: name and cars for each Person:
> SELECT name, out('drives').name as cars FROM Person
>
> Please note that cars is a collection, since one Person may be related
> from zero to many cars.
>
> Cheers,
> Riccardo
>
>
> 2014-03-17 13:34 GMT+01:00 Vikas Iyengar <[email protected]<javascript:>
> >:
>
>> Hi All,
>>
>> I am new to OrientDB and have following structure:
>>
>> 1) Vertex - Person - Luca, Jay, Tom, Henry
>> 2) Vertex - Car - Ferrari, Audi, Chevrolet
>> 3) Vertex - Restaurant - Dante, McD, Hyatt
>> 4) Edge - Eats -
>> Luca -> Eats-> Dante,
>> Luca -> Eats-> McD
>> Jay -> Eats -> McD
>> Tom -> Eats -> Dante
>> Henry -> Eats -> Dante
>> 5) Edge - Drives -
>> Luca -> Drives -> Audi
>> Luca -> Drives -> Ferrari
>> Jay -> Drives -> Chevrolet
>> Tom -> Drives ->Audi
>> Henry -> Drives -> Ferrari
>> Henry -> Drives -> Chevrolet
>>
>> Now, i want to write a SQL that lists the name of the Person and the Car
>> they Drive, who eat at Dante
>>
>> I tried, "Select expand(in('Eats').out('Drives')) from Restaurant where
>> name = 'Dante' "
>>
>> This only prints the name of the Cars, not the name of the Person.
>>
>> Please, help me with the same.
>>
>> --
>>
>> ---
>> 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] <javascript:>.
>> 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.