📅  最后修改于: 2022-03-11 15:05:36.333000             🧑  作者: Mango
SELECT COUNT(*) AS [column_name],
COUNT(*) FILTER (WHERE {column_name}{comparison_operator}{VALUE} )
AS [column_name]
FROM TABLE_NAME;
# e.g.
SELECT COUNT(*) AS no_filter,
COUNT(*) FILTER (WHERE id < 6 ) AS with_filter
FROM employee;