LIMIT in combination with SET operators


I’m trying to retrieve results from two different SELECT statements, MINUS them and keep it within a LIMIT.

Say the results of the two SELECTs are s1 and s2, I’d like to be able to do

res = s1 MINUS s2 LIMIT 10;

However there is a “no viable alternative” for the LIMIT.

Is there any easy way to limit it other than creating a for loop and using an accumulator or similar?



Hi Rene,

The LIMIT clause is only useable within a SELECT statement block.

In our documentation it is only listed under the SELECT statement section.



Yes, but is there a way to SELECT from a vertex Array and apply a limit to it? I tried that, and couldn’t find a way to make it work.

Or are you saying I need to write a while loop or for loop in order to apply a limit?



Hi Rene,

In your case, you can write your query this way:

res = s1 MINUS s2;

res = select s from res:s limit 10;