🔍

Take range (first, last, between)

Take range is given as the fifth argument for select to limit records fetch by the record index.

To grab the first N records from query results, use a positive scalar:

o) t:(+:)`a`b`c!(1 2 3;3 4 5;6 7 8);
o) 0N#.(?[t; (); 0b; `a`c!`a`c; 2])
a c
---
1 6
2 7
o)

To grab the last N records from query results, use a negative scalar:

o) t:(+:)`a`b`c!(1 2 3;3 4 5;6 7 8);
o) 0N#.(?[t; (); 0b; `a`c!`a`c; -2])
a c
---
2 7
3 8
o)

And to grab records within some range, use a two-element vector (from;length):

o)t:(+:)`a`b`c!(1 2 3;3 4 5;6 7 8);
o)0N#.(?[t; (); 0b; `a`c!`a`c; 1 2])
a c
---
2 7
3 8
o)

To grab all records, use a generic null 0N0 or an empty list or a cardinal vector.

o)t:(+:)`a`b`c!(1 2 3;3 4 5;6 7 8);
o)0N#.(?[t; (); 0b; `a`c!`a`c; 0N0])
a c
---
1 6
2 7
3 8
o)0N#.(?[t; (); 0b; `a`c!`a`c; ()])
a c
---
1 6
2 7
3 8
o)

<<< prev DISTINCT
next >>> JOIN