克雷格·克尔斯蒂恩斯:使用 Postgres FILTER
For developers who have been around SQL long enough, they know that there is often more than one way to get the same result. Today I wanted to look at a few different ways to aggregate and show a...
开发者们熟悉SQL,知道有多种方法可以获得相同的结果。本文介绍了三种不同的方法:使用公共表达式(CTE)组织子查询,在聚合上下文中使用CASE语句过滤所需的值,以及使用FILTER清理语法,但实际上与CASE语句相同。最终,我们可以生成每月收入报表,包括已开票、未收取和已收取的金额。