https://www.postgresql.org/docs/15/tutorial-agg.html

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: branyi(dot)laszlo(at)gmail(dot)com
Subject: https://www.postgresql.org/docs/15/tutorial-agg.html
Date: 2022-11-18 21:26:34
Message-ID: 166880679445.636.13036369289525357491@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/tutorial-agg.html
Description:

city | max | count
---------+-----+-------
Hayward | 37 | 5
(1 row)
it's not right

SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo < 30)
FROM weather
GROUP BY city
HAVING max(temp_lo) < 40;

city | max | count
---------+-----+-------
Hayward | 35 | 0

because
SELECT city, max(temp_lo), count(*) FILTER (WHERE temp_lo < 30)
FROM weather
WHERE city LIKE 'S%' -- (1)
GROUP BY city
HAVING max(temp_lo) < 40;
city | max | count
------+-----+-------
(0 rows)

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2022-11-19 14:40:56 Re: https://www.postgresql.org/docs/15/tutorial-agg.html
Previous Message Alvaro Herrera 2022-11-18 08:03:38 Re: Merge statement