Skip to main content
On this page

Kater SQL Functions Date conditions

KATER__IS_ON_OR_BEFORE

True where the date is on or before the value.

Family: Date conditions

Syntax

KATER__IS_ON_OR_BEFORE(field, value)

Arguments

ArgumentDescription
fieldThe date or timestamp to test.
valueThe value to compare with. A value, or a parameter a reader supplies.

Returns

TRUE or FALSE. It is NULL where the field is empty, so a filter leaves that row out.

Usage notes

  • On a timestamp, a date value is midnight at the start of that day. So a later time on that day is not on or before it.

Example

This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.

SELECT
orders.order_month AS "Order Month",
EVAL(orders.count_distinct__order_id) AS "Orders"
FROM kater_dataset.orders AS orders
WHERE
KATER__IS_ON_OR_BEFORE(orders.order_date, DATE '2025-03-31')
GROUP BY
orders.order_month
ORDER BY
1
Order MonthOrders
2025-01-01141
2025-02-01155
2025-03-01133

Compiles to

The call compiles to the same SQL on DuckDB and on Snowflake.

orders.order_date <= CAST('2025-03-31' AS DATE)

See also