I am qorking on OrientDB(2.1.8) database and executing the below query with OrientDB functions (unionall & intersection).
There are userunits of various users, So i want to display the results if atleast one userUnits of two users(@rid=#16:2131,@rid=#16:2130) intersect then result should be displayed.
Suppose user #16:2131 userUnits are [admin,manager] and user #16:2131 userUnits are [admin] only
so 'admin' userUnits are common so results should be displayed but Intersect command is not working.
my below query is working fine with "unionall" function but not working with "intersect".
SELECT expand(unionall($a, $b))
LET $a = (SELECT userUnits FROM #16:2131),
$b = (SELECT userUnits FROM #16:2130)
output comes--> admin,manager supervisor
But when i run my query with intersect function then neither it is showing me any error nor the display results.
SELECT expand(intersect($a, $b))
LET $a = (SELECT userUnits FROM #16:2131),
$b = (SELECT userUnits FROM #16:2130)
You can try this:
SELECT intersect($a.userUnits, $b.userUnits)
LET $a = (SELECT userUnits FROM #16:2131),
$b = (SELECT userUnits FROM #16:2130)
I hope it helps
Bye