У меня есть следующий OrientDB SQL запрос:Sub-выберите в переменной OrientDB
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)
Это не имеет значения, что запрос пытается выполнить. Во всяком случае, он работает в этой форме. Но, как вы можете заметить, существует дублирование из select from user where uuid = 'abc'
. Как я могу извлечь эту часть в переменную и повторно использовать ее несколько раз?
Я уже пробовал:
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)
и
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)
и
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)
, но безрезультатно. Все запросы обрабатываются успешно, но возвращают пустой результат. Что я делаю не так?
Заранее спасибо.