RANK and QUALIFY I believe your friends are here
eg
SEL RANK(custID), custID FROM mydatabase.tblcustomer QUALIFY RANK(custID) < 1000 AND RANK(custID) > 900 ORDER BY custID;
The RANK (field) will (conceptually) retrieve all the rows of the result set, order them in the ORDER BY field and assign them an incremental rank identifier.
QUALIFY allows you to trim this by restricting the strings returned to the qualification expression that RANK can now legitimately scan.
To be clear, I return the 900-1000th lines in the query, select all from cusotmers, NOT returning clients with identifiers from 900 to 1000.
source share