如何计算Postgres 9.6中唯一对的数量?

时间:2018-05-25 14:25:05

标签: postgresql

我想计算唯一对的数量。我正在尝试查询:

select count(distinct a, b) from t

但它给出了错误:

ERROR:  function count(integer, integer) does not exist

如何解决此问题?

1 个答案:

答案 0 :(得分:3)

元组的语法是(a,b)。因此您的查询应该是

select count (distinct (a, b)) ab_count from t