我是OrientDB的新手,我想从B类中获取数据,这取决于A类的值
信息类A
--------------------------------+-------------+-------------------------------+-
NAME | TYPE | LINKED TYPE/CLASS |
--------------------------------+-------------+-------------------------------+-
acol1 | LINKLIST | B |
acol2 | STRING | null |
acol3 | LONG | null |
acol4 | STRING | null |
信息类B
-------------------------------+-------------+-------------------------------+
NAME | TYPE | LINKED TYPE/CLASS |
-------------------------------+-------------+-------------------------------+-
bcol1 | LONG | null |
bcol2 | STRING | null |
bcol3 | LONG | null |
bcol4 | LONG | null |
如果我的标准是acol2是“column2”而bcol1是> 1,< 20。 如何编写查询以获得上述标准的结果。
我试过这个
select flatten(acol1) from A where acol2 = "column2"
有了这个,我将得到B类中与acol2值相关的所有值,但我又想要在B类中过滤记录。我该怎么做呢?
答案 0 :(得分:4)
不要使用flatten我认为已弃用,请改用expand。
你可以做一个内部选择来完成这项工作试试这个:
select from (select expand(acol1) from A where acol2 = "column2") where bcol1 is > 1 and bcol1 < 20