查找分配给另一个字段值的计数
finding counts assigned to another field's value
Create table t1 (col1 (number), col2 (number), col3 (number);
Insert into t1 values (1,1,1);
Insert into t1 values (1,2,5);
Insert into t1 values (1,3,1);
Insert into t1 values (2,1,1);
Insert into t1 values (2,1,1);
Desired result
col1 col2
1 3
2 2
我需要 return col1 中的值和在 col 2 中为每个不同的 col1 值找到的值的计数。不需要 col3
select col1, count(col1) from t1
group by col1
Create table t1 (col1 (number), col2 (number), col3 (number);
Insert into t1 values (1,1,1);
Insert into t1 values (1,2,5);
Insert into t1 values (1,3,1);
Insert into t1 values (2,1,1);
Insert into t1 values (2,1,1);
Desired result
col1 col2
1 3
2 2
我需要 return col1 中的值和在 col 2 中为每个不同的 col1 值找到的值的计数。不需要 col3
select col1, count(col1) from t1
group by col1