I have the following OrientDB SQL query:

select expand($all) let
$a = (select groups, inV().firstName from (
    select expand(outE()) from (select from user where uuid = 'abc')
)),
$b = (select groups, outV().firstName from (
    select expand(inE()) from (select from user where uuid = 'abc')
)),
$all = unionall($a, $b)

It's irrelevant what the query tries to accomplish. Anyway, it works in 
this form. But, as you can notice, there is *duplication* of select from 
user where uuid = 'abc'. How can I extract that part into a variable and 
reuse it multiple times?
------------------------------

I already tried:

select expand($all) let
$x = (select from user where uuid = 'abc'),
$a = (select groups, inV().firstName from (
    select expand(outE()) from $x
)),
$b = (select groups, outV().firstName from (
    select expand(inE()) from $x
)),
$all = unionall($a, $b)

and

select expand($all) let
$x = (select from user where uuid = 'abc'),
$a = (select groups, inV().firstName from (
    select expand($x.outE())
)),
$b = (select groups, outV().firstName from (
    select expand($x.inE())
)),
$all = unionall($a, $b)

and

select expand($all) let
$x = first((select from user where uuid = 'abc')),
$a = (select groups, inV().firstName from (
    select expand($x.outE())
)),
$b = (select groups, outV().firstName from (
    select expand($x.inE())
)),
$all = unionall($a, $b)

but, to no avail. All the queries are parsed successfully, but return empty 
result. What am I doing wrong?

Thanks in advance.

-- 

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