0

I have a requirement wherein I have to find how many times a particular column has repeated. For Example:

Col1 | Col2
------------
1    |2
2    |2
3    |3
4    |3
5    |3

in the above table, value '2' in the column is repeated twice and value '3' is repeated thrice. I want to know a way to find this

Robert
  • 25,425
  • 8
  • 67
  • 81
Ravi Teja
  • 19
  • 1
  • 7

1 Answers1

0

Yous should use group by clause as below

select col2, count(col2)
from tab
group by col2 
Robert
  • 25,425
  • 8
  • 67
  • 81