using let blocks in orientdb select statements -
hopefully quick 1 - i'm struggling make let statement work.
i have database of people vertexes. vertexes have ident fields , name fields. query returns 1 row - person named bob.
select person ident = 1
i want return rows same name person. there 2 bobs in data (as proof, following query returns 2 rows):
select person name = 'bob'
i think of following queries should return same 2 rows, return 0 rows. involve different ways of using let statement. can see i'm doing wrong?
select name person let $tmp = (select person ident = 1) name = $tmp.name select name person let $tmp = (select name person ident = 1) name = $tmp select name person let $tmp = 'bob' name = $tmp
$tmp list of records, asking compare string list, , isn't working. following;
select name person let $tmp = (select person ident = 1) name = first($tmp).name
that wont return person records though (only rows of names). limiting $tmp query improve performance slightly. following better;
select person let $tmp = (select person ident = 1 limit 1) name = first($tmp).name
but actually, using let clause in manner not good. docs
the let block contains list of context variables assign each time record evaluated.
so is* (*should be) better rearrange query entirely;
select expand($persons_with_name) let $person_with_ident = first((select person ident = 1 limit 1)), $persons_with_name = (select person name = $parent.$person_with_ident.name)
Comments
Post a Comment