Hi,
to get the upper level context variable you've to use $parent.record.
Example:

UPDATE Zipcodes SET state=(SELECT @rid FROM States WHERE
id=$parent.$record.state_id);

I never tried with UPDATE but should work.

Lvc@



On 13 January 2014 18:00, Giraldo Rosales <[email protected]> wrote:

> How do we nest queries? Trying to do an update. Have two types of
> documents, zip codes and states. There are two fields in particular in the
> zip code document: "state_id" (String) and "state" (Link). Would like to
> add SELECT the "id" field in the state documents and insert the RID if it
> matches.
>
> I would have thought something like:
> UPDATE Zipcodes SET state=(SELECT @rid FROM States WHERE
> id=Zipcodes.state_id);
>
> Where Zipcodes.state_id is a field in Zipcodes and would match the field,
> States.id. It would then select the RID in States and insert it in the
> ZIpcodes.state field (Link).
>
> In MySQL examples are here:
> http://dev.mysql.com/doc/refman/5.0/en/subqueries.html
>
> How is this done in OrientDB? Saw something with the LET command but
> doesn't seem to work with updates.
>
> Thanks!
>
> --
>
> ---
> 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/groups/opt_out.
>

-- 

--- 
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/groups/opt_out.

Reply via email to