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

RANGEQ() function

The RANGEQ() function returns values between specified timestamps for SETQ columns.

Before you begin

Syntax

RANGEQ(<setq-column>,{<timestamp-start> | NULL},{<timestamp-end> | NULL})

Arguments

Argument Description Additional information
<setq-column> Any IDSETQ or STRINGSETQ column * SET and SETQ data types
<timestamp-start> Unix-epoch timestamp which is the first value in a range from which to return results Substitute NULL if value not known
<timestamp-end> Unix-epoch timestamp which is last value in range from which to return results. Substitute NULL if value not known

Additional information

Only one NULL value is permitted

Returns

Data type Value
TIMESTAMP Returns UNIX-epoch integer timestamp between <timestamp-start> and <timestamp-end>

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           |
+-----+---------------+

Further information