Skip to content

ordinal-number-order-by (QY002)#

Automatic fix is not available.

What it does#

Checks that ORDER BY does not use numeric ordinals (e.g., ORDER BY 1).

Why not?#

Using ordinals reduces readability, makes queries fragile when the SELECT list changes, and obscures intent.

When should you?#

Almost never.

Use instead:#

Explicit column names or expressions.