WHERE

View as Markdown

Syntax fragment: WHERE <condition>

Description

WHERE restricts the historical examples used as prediction context. It does not replace the entity selection in FOR or the request’s indices field.

Temporal context filter

1PREDICT COUNT(orders.*, 0, 30, days) > 0
2FOR customers.customer_id=42
3WHERE COUNT(orders.*, -90, 0, days) > 0

The target looks 30 days forward; the filter requires activity during the preceding 90 days.

Static filter

Current KumoRFM static filters are limited to columns on the same table. Filters that join to a connected table are part of broader PQL grammar but are not supported by the current KumoRFM validator.

1PREDICT customers.segment
2FOR customers.customer_id=42
3WHERE customers.region = "North America"

Inline aggregation filter

Use an inline WHERE to restrict rows counted by an aggregation:

1PREDICT COUNT(orders.* WHERE orders.amount > 100, 0, 30, days)
2FOR customers.customer_id=42

Boolean operators

Combine type-compatible conditions with AND, OR, and NOT. Add conditions incrementally so a validation error can be traced to a single clause.

See Filters and Operators for request-level examples.