I have this query
SELECT
count(*) filter(where condition) as cond_cnt
FROM table
LIMIT 100
But count happening on all table, not respecting LIMIT at all
If I do it with a subquery:
SELECT
count(*) filter(where condition) as cond_cnt
FROM
(SELECT *
FROM table
LIMIT 100
) as sub
Then it works fine. What I am missing?
from the first 100 records of a table (a query) count those that meet a condition (another query).