postgres-cn / pgdoc-cn

PostgreSQL manual Chinese translation by China PostgreSQL Users Group
http://www.postgres.cn/docs
Other
1.79k stars 399 forks source link

2.7节遗漏未译 #435

Closed yukaijian closed 5 days ago

yukaijian commented 9 months ago

2.7. Aggregate Functions最后部分: Another way to select the rows that go into an aggregate computation is to use FILTER, which is a per-aggregate option:

SELECT city, count(*) FILTER (WHERE temp_lo < 45), max(temp_lo) FROM weather GROUP BY city; city | count | max ---------------+-------+----- Hayward | 1 | 37 San Francisco | 1 | 46 (2 rows) FILTER is much like WHERE, except that it removes rows only from the input of the particular aggregate function that it is attached to. Here, the count aggregate counts only rows with temp_lo below 45; but the max aggregate is still applied to all rows, so it still finds the reading of 46. 这部分内容从PG10.0开始就有了,一直未翻译。

TsinghuaLucky912 commented 4 months ago

request

已补充

ChenHuajun commented 5 days ago

thanks