Hi pabloa,

I've made this query that, I hope,it will satisfy your request.

With this one, I'm able to select the user, the days and the 
excursion/picnic, everything ordered from largest to smallest,based on the 
day:

select user,days,excursion,picnic from (select $b.userId as user,$b.day as 
days,$b.excursion as excursion,$b.picnic as picnic,$a.max_day as day from 
User
let $a=(select userId,max(activities.day) as max_day from User where userId=
$parent.current.userId),
$b=(select userId,activities.day as day,activities[type='excursion'].data as 
excursion,activities[type='picnic'].data as picnic from User where userId=
$parent.current.userId)
order by day desc
unwind user)

<https://lh3.googleusercontent.com/-5Il-yf5auio/VxjuwEC7OII/AAAAAAAAACc/IlaGGwZwxKQM0_K8fqgPDTf_Qg2FKnjfACLcB/s1600/max.png>


With this one you can do the same but everything is ordered from smallest 
to largest,based on the day:

select user,days,excursion,picnic from (select $b.userId as user,$b.day as 
days,$b.excursion as excursion,$b.picnic as picnic,$a.min_day as day from 
User
let $a=(select userId,min(activities.day) as min_day from User where userId=
$parent.current.userId),
$b=(select userId,activities.day as day,activities[type='excursion'].data as 
excursion,activities[type='picnic'].data as picnic from User where userId=
$parent.current.userId)
order by day asc
unwind user)


<https://lh3.googleusercontent.com/-Lh3Llm3b6Lo/VxjvMZdJUsI/AAAAAAAAACg/lC6Ad7Y2KIUVTWBVbtxdAMl7LlfW4OsMQCLcB/s1600/min.png>


Hope it helps.

Regards,
Michela

-- 

--- 
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