Hi,

Try this:
select from Subcategories where contracts IN( select *expand(contracts)* 
from Openinterest where fetch_date = '2015-06-02' )

On Tuesday, June 9, 2015 at 4:52:54 PM UTC-3, hartmut bischoff wrote:
>
> still trying to get the basics...
> I want to use the result of one query as where-condition for another one.
>
> The schema is simple:  OpenInterest.(linklist).contracts and 
>  Subcategory.(linklist).contracts 
>
> This works:
>
> select from Subcategories where contracts IN([#21:0,21:2])  # 21.0 and 
> 21,2 are valid Contract.rid's
>
> It fetches all Subcategories which link to the specified Contracts.
> ( {
>     "result": [
>         {
>             "@type": "d",
>             "@rid": "#14:0",
>             "@version": 3,
>             "@class": "Subcategories",
>             "contracts": [
>                 "#21:0",
>                 "#21:42"
>             ],
>             "name": "Computers",
>             "@fieldTypes": "contracts=n"
>         },
>         {
>             "@type": "d",
>             "@rid": "#14:2",
>             "@version": 2,
>             "@class": "Subcategories",
>             "contracts": [
>                 "#21:2"
>             ],
>             "name": "Commer Banks Non-US",
>             "@fieldTypes": "contracts=n"
>         }
>     ],
>     "notification": "Query executed in 0.026 sec. Returned 2 record(s)"
>
>
> Now 
>  
> select from Subcategories where contracts IN( select contracts from 
> Openinterest where fetch_date = '2015-06-02' )
>
> should work too, as
>
> select contracts from Openinterest where fetch_date = '2015-06-02',
>
> results in a row of contracts:
>
> "result": [
>         {
>             "@type": "d",
>             "@rid": "#-2:0",
>             "@version": 0,
>             "contracts": [
>                 "#21:36",
>                 "#21:35",
>                 "#21:34",
>                 "#21:33",
>      (and so on)
>
>
> but it returns only an empty set.  
>
> Anyone who can help on this?
>

-- 

--- 
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