docs← Back to article

Markdown for LLMs

LDC-Q0101 — Ordering comparisons are not part of the query language

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# LDC-Q0101 — Ordering comparisons are not part of the query language

## What it means

A structural query can test equality, difference, and membership — whether
two values match, or one sits inside the other. It cannot ask which of two
values is larger: ordering checks have no meaning over snapshot rows, where
every comparison is a match or a miss. When the text uses a larger-than,
smaller-than, or combined ordering sign, the engine refuses that operator
at the exact spot where it appears.

Restate the question as a match: compare with an equality sign, or move the
ordering logic into a question answered by the core engine over a package,
which is built for exactly that kind of reasoning.

## Example

```lawql
from r in rules where r.id > 3 select r
```

## Fix

```lawql
from r in rules select r
```

## Engine message

The engine reports this in its own wording:

```text
LDC-Q0101: ordinal comparisons are forbidden in LawQL v1 (line 1, column 28). Hint: use query … over … and the core engine
```

## Related

- [Questions to the engine](/constructs/queries/) — which operators a query accepts.
- [LDC-Q0002](/diagnostics/LDC-Q0002/) — when a clause itself is malformed.