user761758
user761758

Reputation: 585

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

I need to return the value in col1 and the count of values found in col 2 for each distinct col1 value. Do not need col3

Upvotes: 0

Views: 33

Answers (1)

Aleem
Aleem

Reputation: 82

select col1, count(col1) from t1
group by col1

Upvotes: 1

Related Questions