Skip to main content Link Menu Expand (external link) Document Search Copy Copied

RANGEQ() function

RANGEQ() is used on IDSETQ or STRINGSETQ data type columns to return values between unix-epoch timestamps.

Before you begin

Syntax

RANGEQ(tq-colum,{ts-begin | null},{ts-end | null})

Arguments

Argument Description Additional information
timequantum-col Any idsetq or stringsetq column that has an assigned timequantum unix-epoch timestamp * IDSETQ()
* STRINGSETQ()
ts-begin Unix-epoch timestamp which is the first value in a range from which to return results Null substitution
ts-end Unix-epoch timestamp which is last value in range from which to return results. Null substitution

Additional information

Valid Timequantum constraint values

IDSETQ() and STRINGSETQ() Timequantum constraints store integer value UNIX-epoch timestamps which are associated with specific values.

null substitution

Substitute null if ts-begin or ts-end is not known.

Returns

Data type Value
Timestamp Returns integer UNIX-epoch timestamps between ts-begin and ts-end inclusive

Examples

Source table definition

CREATE TABLE segments (
    _id id,
    segment stringsetq timequantum 'YMDH'
);
insert into segments(_id,segment)
   VALUES (1, {1789864485,['green', 'yellow']}),
          (2, {1889763885,['green']}),
          (3, {1589763885, ['green', 'red']});

SELECT with two RANGEQ() timestamps

SELECT _id, segment FROM segments WHERE RANGEQ(segment, 1889763885,2000000000);

+-----+---------------+
| _id | segment       |
+-----+---------------+
|   1 | NULL          |
+-----+---------------+
|   2 | GREEN         |
+-----+---------------+
|   3 | NULL          |
+-----+---------------+

SELECT with one RANGEQ() timestamp

select _id, segment from segments where rangeq(segment, null ,2000000000)

+-----+---------------+
| _id | segment       |
+-----+---------------+
|   1 | GREEN,YELLOW  |
+-----+---------------+
|   2 | GREEN         |
+-----+---------------+
|   3 | RED           |
+-----+---------------+