Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 如何计算B列中与A列中每个值关联的唯一值的数量?_Postgresql - Fatal编程技术网

Postgresql 如何计算B列中与A列中每个值关联的唯一值的数量?

Postgresql 如何计算B列中与A列中每个值关联的唯一值的数量?,postgresql,Postgresql,我的数据类似于这样 Column A Column B 101 1001 101 1002 101 1003 101 1004 102 1001 102 1005 102 1006 101 1001 102 1001 column_a unique_column_b

我的数据类似于这样

Column A    Column B
101             1001
101             1002
101             1003
101             1004
102             1001
102             1005
102             1006
101             1001
102             1001
column_a      unique_column_b_vals
101                  4
102                  3
预期输出如下

Column A    Column B
101             1001
101             1002
101             1003
101             1004
102             1001
102             1005
102             1006
101             1001
102             1001
column_a      unique_column_b_vals
101                  4
102                  3

知道COUNT函数支持不同的参数


完美的谢谢