Getting data from a related class in orientdb

I am new to OrientDB, I want to get data from class B, which depend on the value of class A

information class A

--------------------------------+-------------+-------------------------------+-
 NAME                           | TYPE        | LINKED TYPE/CLASS             | 
--------------------------------+-------------+-------------------------------+-
 acol1                          | LINKLIST    | B                             | 
 acol2                          | STRING      | null                          | 
 acol3                          | LONG        | null                          | 
 acol4                          | STRING      | null                          | 

information class B

-------------------------------+-------------+-------------------------------+
 NAME                          | TYPE        | LINKED TYPE/CLASS             | 
-------------------------------+-------------+-------------------------------+-
 bcol1                         | LONG        | null                          | 
 bcol2                         | STRING      | null                          | 
 bcol3                         | LONG        | null                          | 
 bcol4                         | LONG        | null                          | 

If my criteria are acol2, this is "column2" and bcol1 β†’ 1, 20. How can I write a query to get the result for the above criteria.

I tried this

select flatten(acol1) from A where acol2 = "column2"

with this, I get all the values ​​from class B associated with the acol2 value, but again I want to filter the entries in class B. How can I do this?

+4
source share
1 answer

Do not use flatten, I believe that it is deprecated, use the extension instead.

:

select from (select expand(acol1) from A where acol2 = "column2") where bcol1 is > 1 and bcol1 < 20
+4

Source: https://habr.com/ru/post/1570888/


All Articles