David Laberge
David Laberge

Reputation: 16051

Orientdb query child

Is there a way with Orientdb 2.1.11 (document database) to get the EmebeddedList

Here is the class structure

{
    "@class":"Quote",
    "number":"Q1",
    "details":[{
      "code":"123",
      "price":10
      },{
      "code":"456",
      "price":20
      }
    ]
},{
    "@class":"Quote",
    "number":"Q2",
    "details":[{
      "code":"789",
      "price":15
      },{
      "code":"951",
      "price":25
      }
    ]
}

I would like a query that will return the following :

number| code | price
------|------|------
Q1    | 123  | 10
Q1    | 456  | 20
Q2    | 789  | 15
Q2    | 951  | 25

Upvotes: 0

Views: 116

Answers (1)

Alessandro Rota
Alessandro Rota

Reputation: 3570

I have replicated your structure

enter image description here

and I have used this query

select number, details.code as code, details.price as price from (select prop.number as number, prop.details as details from (select prop from test unwind prop) unwind details)

enter image description here

Hope it helps

Upvotes: 1

Related Questions