Skip to main content

SELECT Filter

Truncates the data returned by a query.

bSQL Syntax Conventions

Syntax​

FILTER <filter_expression>

<filter_expression> ::=
{ top_uint | (TOP = top_uint, OFFSET = offset_uint) |
PAGE( page_size, num_pages, start_page ) }

Arguments​

top_uint
Specifies the number of values to return from the query.

offset_uint
Specifies the offset of the filter. Filter will error if the offset is greater than the number of records in the iterator.

  • If TOP and OFFSET are specified, the top_uint number of values returned starts after the offset_uint number of records.

PAGE
Specifies that the filtering will be done by paging.

page_size
The number of records per page.

num_pages
The number of to iterate through.

start_page
The starting page of the paged data.

Examples​

A. Specifying a simple filter.​

The following example returns the first 10 results of the query.

SELECT *
FROM financial.pricing
ORDER BY price
FILTER 10

B. Using an offset.​

The following example returns 10 records after the first 10 are skipped.

SELECT *
FROM financial.pricing
ORDER BY price
FILTER (TOP = 10, OFFSET = 10)

C. Paging data.​

The following example returns 100 records (page_size * num_pages) after skipping the first 50 records (start_page * page_size)

SELECT *
FROM financial.pricing
FILTER PAGE(25, 4, 2)

See Also​