Hello,

I have a class *User* with this structure (same structure than my question 
of the other day).

{
"userId":23232,
"activities": [{"day": 27, "type": "excursion", data: "Buenos Aires"}, 
{"day": 28, "type": "picnic", data: "Delta Tigre"}, {"day": 30, "type": 
"nightclub", data: "Oh lalala"}, .... ] 
}

I want to generate a query with 3 columns: userId, excursion and picnic. 
Therefore I execute the query below based in the answer to my question of 
the other day:

SELECT userId,
activities[type = 'excursion'].data as excursion, 
activities[type = 'picnic'].data as picnic
from User UNWIND excursion, picnic

The result us something like:

*userId, excursion, picnic*
23232, "Buenos Aires", "Delta Tigre"
23235, "Buenos Aires", "Parque Pereira Iraola"
23237, "Entre Ríos", "Iglesia de Nra Sra del Pilar"
... (more rows).

So in general, it works.

But we noticed that if a user has activities of both types, they are listed 
in the query output. BUT users with only activities of type "excursion" OR 
(exclusive) type "picnic" are not included in the output. 

What I would like to get is something like:

*userId, excursion, picnic*
23232, "Buenos Aires", "Delta Tigre"
23233, "Buenos Aires", *(null or empty)*
23234, *(null or empty)*, "Delta Tigre"
23235, "Buenos Aires", "Parque Pereira Iraola"
23236, *(null or empty)*, "Playa Larga"
23237, "Entre Ríos", "Iglesia de Nra Sra del Pilar"
... (more rows).

In other words, I want all the users with *at least* 1 activity of type 
picnic or excursion.

How is the query to get the above output?

I am using OrientDb 2.1.13. I am open to upgrade to newer versions.

Pablo

-- 

--- 
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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to