clause
FILTER
Restricts the rows fed into one aggregate, without removing rows from other aggregates. Example target: PostgreSQL 17 and SQLite (local fixture tested).
Formal Syntax & Structure
sql syntaxsql
aggregate(...) FILTER (WHERE condition)Working Example
Example Snippetsql
SELECT COUNT(*), COUNT(*) FILTER (WHERE amount > 100) FROM orders;