Hi,
you are really close to the solution ;-)
Just replace the AND with an OR
select part_id from Parameter where
(name='a' and value='10')
OR
(name='b' and value='15')
Just a couple of hints:
1) create a composite index on name and value, it will speed up your
queries a lot
2) if 'part' is a complex object, I suggest you to declare part_id as a
link and let it point to the 'part' object, in this case your query will
probably be
select expand(part_id) from Parameter where
(name='a' and value='10')
OR
(name='b' and value='15')
Just a little question: is there a particular reason why you are defining a
Parameter class, instead of having a complex 'part' object with many
(schemaless) parameters?
Luigi
2015-09-19 11:02 GMT+02:00 mecp <[email protected]>:
> I am having difficulty in achieving this:
> I have a class *Parameter* with these properties
>
>
> - part_id
>
> - name
>
> - value.
>
>
> One part could have many parameters so part_id and name make a unique
> candidate.
>
>
> I want to query all the parts which match given conditions for name and
> value.
>
>
> For example:
>
> select part_id from Parameter where (
>
> (name='a' and value='10')
>
> and
>
> (name='b' and value='15')
>
> )
>
>
> I know this is wrong sql but I wrote it to show my intent. In other DB
> queries it would require JOINS to achieve this, but in orientdb I have no
> clue how I can do this. I am using orientdb as a document db in embedded
> mode.
>
>
> Could someone help on this for orientdb?
>
> --
>
> ---
> 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.