Ervan uitgaande dat je ze bestelt 1 - 10000
enige logica gebruiken en alleen rijen uitvoeren 1-100,2001-2100,4001-4100,etc
dan kun je de ROWNUM
. gebruiken pseudokolom:
SELECT *
FROM (
SELECT t.*,
ROWNUM AS rn -- Secondly, assign a row number to the ordered rows
FROM (
SELECT *
FROM your_table
ORDER BY your_condition -- First, order the data
) t
)
WHERE MOD( rn - 1, 2000 ) < 100; -- Finally, filter the top 100 per 2000.
Of u kunt de ROW_NUMBER()
. gebruiken analytische functie:
SELECT *
FROM (
SELECT t.*,
ROW_NUMBER() OVER ( ORDER BY your_condition ) AS rn
FROM your_table
)
WHERE MOD( rn - 1, 2000 ) < 100;
Vervang de WHERE
clausule met:
WHERE rn - POWER(
2,
TRUNC( CAST( LOG( 2, CEIL( rn / 1000 ) ) AS NUMBER(20,4) ) )
) * 1000 + 1000 <= 100