Hi Leif,

in your subquery the "brand" property is a string, while "loc" is a
collection, so you cannot use LIKE operator on it.
You have many alternatives to fix it:
1) if you are sure that out("ProducedIn").name will always produce only one
result, you can replace it with  out("ProducedIn")[0].name

2) if you are using 2.1 RC you can use UNWIND operator to unwind the
collections, eg.

select brand, loc, r. fg from ( select name as brand,
out("ProducedIn").name as loc, out("ProducedIn").out("InRegion").name as r
, out("HasFlavours").out("FlavourInGroup").name as fg from Whisky UNWIND
loc ) where loc like "A%"

in this case you will receive multiple rows of result if you have multiple
"loc" values

3) you can write a simple js function that checks all the items in the
"loc" collection for that condition

Regards

Luigi



2015-05-17 9:03 GMT+02:00 Leif Jantzen <[email protected]>:

> Hi,
>
> In the (brand new) public database on Whisky the following query returns 6
> rows:
>
> select brand, loc, r. fg from ( select name as brand,
> out("ProducedIn").name as loc, out("ProducedIn").out("InRegion").name as r
> , out("HasFlavours").out("FlavourInGroup").name as fg from Whisky ) where
> brand like "A%"
>
> but if I want to filter on one of the other projected fields, no results
> are returned.
>
> select brand, loc, r. fg from ( select name as brand,
> out("ProducedIn").name as loc, out("ProducedIn").out("InRegion").name as r
> , out("HasFlavours").out("FlavourInGroup").name as fg from Whisky ) where
> loc like "A%"
>
> Coming from a SQL background, I find this not so intuitive.   How do I
> formulate this query?
>
>
>
>  --
>
> ---
> 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.
>

-- 

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