Hi Guys,

I have my database modeled like this

Company <- Employs -> Employee <- Owns -> Account

Company has: 

   - name 
   - status
   - city
   
Employee has: 

   - name
   - type
   
Account has: 

   - balance 
   - type
   

So I came up this a select like this:

SELECT name as n, sum($account.balance) as bal, $company.name as company
FROM Employee 
WHERE 
    name='Cap. America'
    and  (($account.type = 'C' and $company.status = 'A')  or 
($account.type = 'P' or $company.status = 'B'))
LET 
  $account = out('Owns')
  $company = in('Employs')

But I realize since an Employee has multiple accounts, it's treated as a 
collection and then the where clause expression that uses account does not 
work.

I believe I'm thinking like in a RDBMS, so I would be appreciated if you 
help me figure this out. In a nutshell what I want is to bring data from 
three different vertices filtering by attributes from all of them, even 
when the adjacent vertex came as a collection. 

Thank you for your attention

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to