Awesome! FWIW, the desired result is achieved without the GROUP BY at the
end. So the following does the same thing:
SELECT
DriverID, DriverName, list(CarCost)
FROM ( MATCH {...} RETURN ...)
I have to admit that I still don't fully understand what list() is doing.
The documentation doesn't quite get me there. The good news is that I can
do what I want to do.
Thanks so much for your help.
-Michael
On Thursday, March 7, 2019 at 6:28:15 AM UTC-5, Luigi Dell'Aquila wrote:
>
> SELECT
> DriverID, DriverName, list(CarCost)
> FROM ( ... )
> GROUP BY DriverID, DriverName
>
> Il giorno gio 7 mar 2019 alle ore 12:27 Luigi Dell'Aquila <
> [email protected] <javascript:>> ha scritto:
>
>> oh, sorry, I didn't scroll the screen :D
>>
>> You have to use a set() or list() aggregation on CarCost and do a GROUP
>> BY on the other columns
>>
>> Thanks
>>
>> Luigi
>>
>> Il giorno gio 7 mar 2019 alle ore 12:26 Luigi Dell'Aquila <
>> [email protected] <javascript:>> ha scritto:
>>
>>> Hi Michael,
>>>
>>> Just add a DISTINCT to the RETURN, ie
>>>
>>> RETURN DISTINCT driver.@rid AS DriverID, driver.name AS DriverName,
>>> car.cost AS CarCost
>>>
>>> Thanks
>>>
>>> Luigi
>>>
>>> Il giorno mer 6 mar 2019 alle ore 22:46 Michael Faughn <
>>> [email protected] <javascript:>> ha scritto:
>>>
>>>> SELECT * FROM (MATCH {Class: Person, as: driver, where:(name='Bob')}-
>>>> Driving->{Class: Vehicle, as:car} RETURN driver.@rid AS DriverID,
>>>> driver.name AS DriverName, car.cost AS CarCost)
>>>>
>>>> results in the following:
>>>>
>>>> DriverID
>>>> DriverName
>>>> CarCost
>>>> #332:0
>>>> <http://localhost:2480/studio/index.html#/database/test/browse/edit/332:0>
>>>> Bob
>>>> 222
>>>> #332:0
>>>> <http://localhost:2480/studio/index.html#/database/test/browse/edit/332:0>
>>>> Bob
>>>> 111
>>>>
>>>> I would instead like the following:
>>>>
>>>> DriverID
>>>> DriverName
>>>> CarCost
>>>> #332:0
>>>> <http://localhost:2480/studio/index.html#/database/test/browse/edit/332:0>
>>>> Bob
>>>> [222, 111]
>>>>
>>>> Is there a way to write the query so that this can happen?
>>>>
>>>> --
>>>>
>>>> ---
>>>> 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.