4

Am new to OrientDB, i want to fetch data from class B which depends on the value of class A

info class A

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

info class B

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

If my criteria is acol2 is "column2" and bcol1 is > 1 , < 20. How can i write query to get the result for the above criteria.

I have tried this

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

with this i will get all the values from class B that are related to acol2 value, but again i want to filter records in class B. How can i do this.?

Community
  • 1
  • 1
Shri
  • 469
  • 5
  • 18

1 Answers1

4

Do not use flatten i think is deprecated, use expand instead.

you can make an inner select to do the job try this:

select from (select expand(acol1) from A where acol2 = "column2") where bcol1 is > 1 and bcol1 < 20
wolf4ood
  • 1,939
  • 10
  • 8